Problem:
Score : 400 points

Problem Statement

There are N persons called Person 1 through Person N.

You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times.

If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.

Takahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.

At least how many groups does he need to make?

Constraints

2 \leq N \leq 2\times 10^5

0 \leq M \leq 2\times 10^5

1\leq A_i,B_i\leq N

A_i \neq B_i

Input

Input is given from Standard Input in the following format:

N M
A_1 B_1
\vdots
A_M B_M

Output

Print the answer.

Sample Input 1

5 3
1 2
3 4
5 1

Sample Output 1

3

Dividing them into three groups such as \{1,3\}, \{2,4\}, and \{5\} achieves the goal.

Sample Input 2

4 10
1 2
2 1
1 2
2 1
1 2
1 3
1 4
2 3
2 4
3 4

Sample Output 2

4

Sample Input 3

10 4
3 1
4 1
5 9
2 6

Sample Output 3

3

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;

#define M 200010
#define MAXX 999999999999999
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

int parent[M];
int sizee[M];

int root(int x)
{
   while(parent[x]!=x)
   {
      parent[x] = parent[parent[x]];
      x = parent[x];
   }
   return x;
}

void Union(int A,int B)
{
   int root_A = root(A);
   int root_B = root(B);
   
   if(root_A==root_B)
   return;

   if(root_A<root_B)
   {
     parent[root_A]=root_B;
     sizee[root_B]+=sizee[root_A];
   }
   else
   {
     parent[root_B]=root_A;
     sizee[root_A]+=sizee[root_B];
   }
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   
//   freopen("input.txt","rt",stdin);

   int n,m;
   cin>>n>>m;
   
   for(int i=1;i<=n;i++)
   {
      parent[i] = i;
      sizee[i] = 1;
   }

   for(int i=0;i<m;i++)
   {
      int u,v;
      cin>>u>>v;
      Union(u,v);
   }
     
   vector<int> all_res;
   for(int i=1;i<=n;i++)
   {
      if(parent[i]==i)
      {
         if(sizee[i]>1)
         {
//            cout<<"i = "<<i<<"  size = "<<sizee[i]<<"\n";
            all_res.ep(sizee[i]);
         }
      }
   }
   
   int ans = 0;
   while(true)
   {
      vector<int> temp;
      for(int i=0;i<(int)all_res.size();i++)
      {
         int x = all_res[i];
//         cout<<all_res[i]<<" ";
         if(x>0)
         {
            x--;
            temp.ep(x);
         }
      }
      
      int len = (int)temp.size();
      if(len>1)
      {
         all_res.clear();
         all_res = temp;
         ans++;
      }
      else if(len == 1)
      {
         ans += (temp[0]+1);
         break;
      }
      else
         break;
         
      temp.clear();
//      cout<<"  ans = "<<ans<<"\n";
   }
   
   cout<<ans<<"\n";
}