from collections import deque



n,m = list(map(int,input().split()))

graph = [[] for _ in range(n+1)]

for _ in range(m):

    a,b = list(map(int,input().split()))

    graph[a].append(b)

    graph[b].append(a)

ans = 1



def dfs(node):

    while len(todo) > 0:

        node = todo.pop()

        if tf[node] == 0:

            tf[node] = 1

            seen.add(node)

            for nextnode in graph[node]:

                todo.append(nextnode)



todo = deque()

done = set()

tf = [0 for _ in range(n+1)]

for i in range(1,n+1):

    if i in done:

        continue

    else:

        todo.append(i)

        seen = set()

        dfs(i)

        #print(i,seen)

        ans = max(ans,len(seen))

        done |= seen

print(ans)
from collections import *

n,m = list(map(int,input().split()))

par = [-1 for _ in range(n)]#par<0なら自身が親で要素の個数、>0なら子で親の位置示す



def root(i):

    if par[i] < 0:

        return i

    else:

        return root(par[i])



def size(a):

    return -par[root(a)]



def union(a,b):

    a = root(a)

    b = root(b)

    if a == b:#親が等しい

        return False

    if size(a) < size(b):#サイズが大きい方に繋げる

        a,b = b,a

    par[a] += par[b]

    par[b] = a

    return True



for i in range(m):

    a = [int(j)-1 for j in input().split()]#数字を一つ減らして足を揃える

    if root(a[0]) != root(a[1]):

        union(a[0],a[1])

print((max([ size(i) for i in par])))
from collections import deque

n, m = list(map(int, input().split()))
graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    graph[a].append(b)
    graph[b].append(a)
ans = 1


def dfs(node):
    while len(todo) > 0:
        node = todo.pop()
        if tf[node] == 0:
            tf[node] = 1
            seen.add(node)
            for nextnode in graph[node]:
                todo.append(nextnode)


todo = deque()
done = set()
tf = [0 for _ in range(n + 1)]
for i in range(1, n + 1):
    if i in done:
        continue
    else:
        todo.append(i)
        seen = set()
        dfs(i)
        # print(i,seen)
        ans = max(ans, len(seen))
        done |= seen
print(ans)

from collections import *

n, m = list(map(int, input().split()))
par = [-1 for _ in range(n)]  # par<0なら自身が親で要素の個数、>0なら子で親の位置示す


def root(i):
    if par[i] < 0:
        return i
    else:
        return root(par[i])


def size(a):
    return -par[root(a)]


def union(a, b):
    a = root(a)
    b = root(b)
    if a == b:  # 親が等しい
        return False
    if size(a) < size(b):  # サイズが大きい方に繋げる
        a, b = b, a
    par[a] += par[b]
    par[b] = a
    return True


for i in range(m):
    a = [int(j) - 1 for j in input().split()]  # 数字を一つ減らして足を揃える
    if root(a[0]) != root(a[1]):
        union(a[0], a[1])
print((max([size(i) for i in par])))

-from collections import deque +from collections import * -graph = [[] for _ in range(n + 1)] -for _ in range(m): -    a, b = list(map(int, input().split())) -    graph[a].append(b) -    graph[b].append(a) -ans = 1 +par = [-1 for _ in range(n)]  # par<0なら自身が親で要素の個数、>0なら子で親の位置示す -def dfs(node): -    while len(todo) > 0: -        node = todo.pop() -        if tf[node] == 0: -            tf[node] = 1 -            seen.add(node) -            for nextnode in graph[node]: -                todo.append(nextnode) +def root(i): +    if par[i] < 0: +        return i +    else: +        return root(par[i]) -todo = deque() -done = set() -tf = [0 for _ in range(n + 1)] -for i in range(1, n + 1): -    if i in done: -        continue -    else: -        todo.append(i) -        seen = set() -        dfs(i) -        # print(i,seen) -        ans = max(ans, len(seen)) -        done |= seen -print(ans) +def size(a): +    return -par[root(a)] + + +def union(a, b): +    a = root(a) +    b = root(b) +    if a == b:  # 親が等しい +        return False +    if size(a) < size(b):  # サイズが大きい方に繋げる +        a, b = b, a +    par[a] += par[b] +    par[b] = a +    return True + + +for i in range(m): +    a = [int(j) - 1 for j in input().split()]  # 数字を一つ減らして足を揃える +    if root(a[0]) != root(a[1]): +        union(a[0], a[1]) +print((max([size(i) for i in par])))