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 Go (1.14.1) (judge verdict: Runtime Error)

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var nm = readInts()
	n := nm[0]
	m := nm[1]

	var storea = make([]string, m, m)
	var storeb = make([]string, m, m)
	for i := 0; i < m; i++ {
		var ab = readLine()
		storea[i] = ab[0]
		storeb[i] = ab[1]
	}

	var connection = make([][]int, n, n)
	for i := 0; i < m; i++ {
		aa, _ := strconv.Atoi(storea[i])
		bb, _ := strconv.Atoi(storeb[i])
		a := aa - 1
		b := bb - 1
		connection[a] = append(connection[a], b)
		connection[b] = append(connection[b], a)
	}

	var groupIDs = make([]int, n)
	for i := 0; i < n; i++ {
		groupIDs[i] = -1
	}

	var marking func(i int, group int)
	marking = func(i int, group int) {
		if groupIDs[i] != -1 {
			return
		}
		groupIDs[i] = group
		for _, next := range connection[i] {
			marking(next, group)
		}
	}
	for i := 0; i < n; i++ {
		marking(i, i)
	}
	var counter = make([]int, n, n)
	for _, v := range groupIDs {
		counter[v]++
	}
	var temp = 0
	for _, v := range counter {
		if temp < v {
			temp = v
		}
	}
	fmt.Printf("%v\n", temp)

}

func readLine() []string {
	rdr := bufio.NewReaderSize(os.Stdin, 1000000)
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return strings.Split(string(buf), " ")
}

func readInts() []int {
	var strs = readLine()
	var ret []int
	for _, v := range strs {
		c, _ := strconv.Atoi(v)
		ret = append(ret, c)
	}
	return ret
}