Start: Feb, 21, 2019 12:00:00
2018-2019 ACM集训队冬季集训第二次考核
End: Feb, 21, 2019 17:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 163ms
Memory: 8668kB
Author: 2017212212209
In contest: 1261

/*
 I have a dream!A AC deram!!
 orz orz orz orz orz orz orz orz orz orz orz
 orz orz orz orz orz orz orz orz orz orz orz
 orz orz orz orz orz orz orz orz orz orz orz

 */

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
const int maxn=1e6;
int F[maxn];
int find(int x)
{
	if(F[x]==x) return x;
	else return F[x]=find(F[x]);
}

void bing(int x,int y)
{
	int fx=find(x),fy=find(y);
	if(fx!=fy)
		F[fx]=fy;
}

/*
12 8
1 2
3 4
4 5
6 7
7 8
9 10
10 11
11 12
*/


int main()
{
	int n,m;
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		map<int,int>num;
		for(int i=1;i<=n;i++)
			F[i]=i;
		for(int i=0;i<m;i++)
		{
			int u,v;
			scanf("%d %d",&u,&v);
			bing(u,v);
		}
		map<int,int>::iterator it;
		int maxx=0;
		for(int i=1;i<=n;i++)
		{
			num[find(F[i])]++;
			maxx=max(maxx,num[find(F[i])]);
		}
		//for(it=num.begin();it!=num.end();it++)
			//printf("%d %d\n",it->first,it->second);
		printf("%d\n",maxx);
	}
	return 0;
}