# include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, k, ans, maxx, vis[N], a[N][N];
queue<int> q;
void solve(int x) {
    q.push(x);
    ans++;
	vis[x] = 1;
    int cnt=0;
    while(!q.empty()){
        int x=q.front();
        q.pop();
        for(int i=1;i<=n;i++){
            if(i!=x&&a[x][i]&&!vis[i]){
                vis[i]=1;
                q.push(i);
                cnt++;
            }
        }
    }
    maxx=max(maxx,cnt+1);
}
int main(){
    cin>>n>>k;
    int x,y;
    for(int i=1;i<=k;i++){
        scanf("%d%d",&x,&y);
        a[x][y]=a[y][x]=1;
    }
    for(int i=1;i<=n;i++)
        if(!vis[i])solve(i);
    cout<<ans<<" "<<maxx;
    return 0;
}