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# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int[] NM = ria();
		int N = NM[0];
		int M = NM[1];
		HashSet<Tree> trees = new HashSet<Tree>();
		Node[] nodes = new Node[N];
		for (int i = 0; i < N; i++)
		{
			Tree tree = new Tree(i);
			nodes[i] = new Node(i, tree);

			tree._nodes.Add(nodes[i]);
			trees.Add(tree);
		}

		for (int i = 0; i < M; i++)
		{
			int[] relation = ria();
			nodes[relation[1] - 1].SetParent(nodes[relation[0] - 1], ref trees);
		}

		int ans = 1;
		foreach (Tree tree in trees)
		{
			ans = Math.Max(ans, tree._nodes.Count());
		}

		Console.WriteLine(ans);
		Console.ReadLine();
	}

	class Node {
		int _index;
		Node _parent;
		// HashSet<Node> _children = new HashSet<Node>();
		Tree _tree;

		public Node(int index, Tree tree) {
			_index = index;
			_tree = tree;
		}

		public void SetParent(Node parent, ref HashSet<Tree> trees) {
			if(parent._parent == this) return;
			// parent._children.Add(this);
			_parent = parent;

			if(_tree != parent._tree) {
				trees.Remove(_tree);
				parent._tree.SetNodes(_tree._nodes);
				_tree = parent._tree;
			};
		}

		public bool IsSameGroup(Node node) {
			return GetTopParent() == node.GetTopParent();
		}

		public Node GetTopParent() {
			if(_parent == null) return this;

			while(_parent._parent != null) {
				_parent = _parent._parent;
			};

			return _parent;
		}
	}

	class Tree {
		int _id;
		public HashSet<Node> _nodes = new HashSet<Node>();

		public Tree(int id) {
			_id = id;
		}

		public void SetNodes(HashSet<Node> nodes) {
			foreach (Node node in nodes)
			{
				_nodes.Add(node);
			}
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static BigInteger rb(){return BigInteger.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
	static BigInteger[] rba(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>BigInteger.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}