from collections import deque



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

g = {i:set() for i in range(N)}

v = [-1 for i in range(N)]

for _ in range(M):

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

  a, b = a-1, b-1

  g[a].add(b)

  g[b].add(a)



Q = deque()

ans = 0

for a in g:

  if v[a]==-1:

    v[a] = 1

    ans_tmp = 1

    Q.append(a)

    while len(Q)>0:

      na = Q.popleft()

      for nb in g[na]:

        if v[nb] == -1:

          v[nb] = 1

          ans_tmp += 1

          Q.append(nb)

    ans = max(ans, ans_tmp)

print(ans)

from collections import deque



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

friends = [[] for _ in range(N)]



for _ in range(M):

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

    a, b = a-1, b-1

    friends[a].append(b)

    friends[b].append(a)



checked = [False] * N

ans = 0



for i in range(N):

    if checked[i] == False:

        checked[i] = True

        DQ = deque(friends[i])

        tmp = 1

        while DQ:

            f = DQ.popleft()

            if checked[f] == False:

               checked[f] = True

               tmp += 1

               for j in friends[f]:

                   DQ.append(j)

        ans = max(ans, tmp)



print(ans)
from collections import deque

N, M = list(map(int, input().split()))
g = {i: set() for i in range(N)}
v = [-1 for i in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    g[a].add(b)
    g[b].add(a)
Q = deque()
ans = 0
for a in g:
    if v[a] == -1:
        v[a] = 1
        ans_tmp = 1
        Q.append(a)
        while len(Q) > 0:
            na = Q.popleft()
            for nb in g[na]:
                if v[nb] == -1:
                    v[nb] = 1
                    ans_tmp += 1
                    Q.append(nb)
        ans = max(ans, ans_tmp)
print(ans)

from collections import deque

N, M = list(map(int, input().split()))
friends = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    friends[a].append(b)
    friends[b].append(a)
checked = [False] * N
ans = 0
for i in range(N):
    if checked[i] == False:
        checked[i] = True
        DQ = deque(friends[i])
        tmp = 1
        while DQ:
            f = DQ.popleft()
            if checked[f] == False:
                checked[f] = True
                tmp += 1
                for j in friends[f]:
                    DQ.append(j)
        ans = max(ans, tmp)
print(ans)

-g = {i: set() for i in range(N)} -v = [-1 for i in range(N)] +friends = [[] for _ in range(N)] -    g[a].add(b) -    g[b].add(a) -Q = deque() +    friends[a].append(b) +    friends[b].append(a) +checked = [False] * N -for a in g: -    if v[a] == -1: -        v[a] = 1 -        ans_tmp = 1 -        Q.append(a) -        while len(Q) > 0: -            na = Q.popleft() -            for nb in g[na]: -                if v[nb] == -1: -                    v[nb] = 1 -                    ans_tmp += 1 -                    Q.append(nb) -        ans = max(ans, ans_tmp) +for i in range(N): +    if checked[i] == False: +        checked[i] = True +        DQ = deque(friends[i]) +        tmp = 1 +        while DQ: +            f = DQ.popleft() +            if checked[f] == False: +                checked[f] = True +                tmp += 1 +                for j in friends[f]: +                    DQ.append(j) +        ans = max(ans, tmp)