N, M = list(map(int, input().split()))

friends = {i: set([]) for i in range(N)}

for i in range(M):

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

    a -= 1

    b -= 1

    friends[a].add(b)

    friends[b].add(a)

#print(friends)

from collections import deque



reached = [-1] * N

ans = 1

for i in range(N):

    if reached[i] == -1:

        queue = deque()

        queue.append(i)

        t = 1

        reached[i] = 0

        while len(queue) > 0:

            v = queue.popleft()

            for n in friends.get(v):

                if reached[n] == -1:

                    reached[n] = 0

                    queue.append(n)

                    t += 1

    ans = max(ans, t)

print(ans)

N, M = list(map(int, input().split()))

t = [-1] * N



import sys

sys.setrecursionlimit(10 ** 6)

def find(e):

    if t[e] < 0:

        return e

    else:

        t[e] = find(t[e])

        return t[e]





def unite(a, b):

    a_root = find(a)

    b_root = find(b)

    if a_root == b_root:

        return

    t[a_root] += t[b_root]

    t[b_root] = a_root





for i in range(M):

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

    a -= 1

    b -= 1

    unite(a, b)





def size(x):

    x = find(x)

    return -t[x]





ans = 0

for i in range(N):

    ans = max(ans, size(i))

print(ans)



N, M = list(map(int, input().split()))
friends = {i: set([]) for i in range(N)}
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    friends[a].add(b)
    friends[b].add(a)
# print(friends)
from collections import deque

reached = [-1] * N
ans = 1
for i in range(N):
    if reached[i] == -1:
        queue = deque()
        queue.append(i)
        t = 1
        reached[i] = 0
        while len(queue) > 0:
            v = queue.popleft()
            for n in friends.get(v):
                if reached[n] == -1:
                    reached[n] = 0
                    queue.append(n)
                    t += 1
    ans = max(ans, t)
print(ans)

N, M = list(map(int, input().split()))
t = [-1] * N
import sys

sys.setrecursionlimit(10**6)


def find(e):
    if t[e] < 0:
        return e
    else:
        t[e] = find(t[e])
        return t[e]


def unite(a, b):
    a_root = find(a)
    b_root = find(b)
    if a_root == b_root:
        return
    t[a_root] += t[b_root]
    t[b_root] = a_root


for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    unite(a, b)


def size(x):
    x = find(x)
    return -t[x]


ans = 0
for i in range(N):
    ans = max(ans, size(i))
print(ans)

-friends = {i: set([]) for i in range(N)} +t = [-1] * N +import sys + +sys.setrecursionlimit(10**6) + + +def find(e): +    if t[e] < 0: +        return e +    else: +        t[e] = find(t[e]) +        return t[e] + + +def unite(a, b): +    a_root = find(a) +    b_root = find(b) +    if a_root == b_root: +        return +    t[a_root] += t[b_root] +    t[b_root] = a_root + + -    friends[a].add(b) -    friends[b].add(a) -# print(friends) -from collections import deque +    unite(a, b) -reached = [-1] * N -ans = 1 + +def size(x): +    x = find(x) +    return -t[x] + + +ans = 0 -    if reached[i] == -1: -        queue = deque() -        queue.append(i) -        t = 1 -        reached[i] = 0 -        while len(queue) > 0: -            v = queue.popleft() -            for n in friends.get(v): -                if reached[n] == -1: -                    reached[n] = 0 -                    queue.append(n) -                    t += 1 -    ans = max(ans, t) +    ans = max(ans, size(i))