Buggy python submission (verdict: Runtime Error):
from collections import Counter

class UnionFindBasic():
    """via https://note.nkmk.me/python-union-find/#_3
    """
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x: int) -> int:
        if self.parents[x] == x: return x
        return self.find(self.parents[x])

    def union(self, x: int, y: int):
        x = self.find(x)
        y = self.find(y)
        if x == y: return
        if x > y: x,y = y,x
        self.parents[y] = x

if __name__ == '__main__':
    N, M = map(int, input().split())

    if M == 0:
        print(0)
        return

    uf = UnionFindBasic(N)

    for _ in range(M):
        a,b = list(map(lambda x: int(x)-1, input().split()))
        uf.union(a,b)

    print(Counter(uf.parents).most_common()[0][1])

Fixed submission:
# from pprint import pprint
#
# N, M = map(int, input().split())
#
# G = [[0 for _ in range(N)] for _ in range(N)]
#
# for _ in range(M):
#     a, b = list(map(int, input().split()))
#     G[a-1][b-1] = G[b-1][a-1] = 1
#
# pprint(sum(sum(g) for g in G) // 2)

from collections import Counter

class UnionFindBasic():
    """via https://note.nkmk.me/python-union-find/
    """
    def __init__(self, n: int):
        # < 0 は根
        self.n = n
        self.parents = [-1] * n

    def find(self, x: int) -> int:
        if self.parents[x] < 0:
            return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x: int, y: int):
        x = self.find(x)
        y = self.find(y)
        if x == y: return
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

def main():
    N, M = map(int, input().split())

    if M == 0:
        print(1)
        return

    uf = UnionFindBasic(N)

    for _ in range(M):
        a,b = list(map(lambda x: int(x)-1, input().split()))
        uf.union(a,b)

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

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from collections import Counter

class UnionFindBasic():
    """via https://note.nkmk.me/python-union-find/#_3
    """
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x: return x
        return self.find(self.parents[x])

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y: return
        self.parents[y] = x

if __name__ == '__main__':
    N, M = map(int, input().split())

    uf = UnionFindBasic(N)

    for _ in range(M):
        a,b = list(map(lambda x: int(x)-1, input().split()))
        if a < b:
            uf.union(a,b)
        else:
            uf.union(b,a)

    print(Counter(uf.parents).most_common()[0][1])

Fixed submission:
# from pprint import pprint
#
# N, M = map(int, input().split())
#
# G = [[0 for _ in range(N)] for _ in range(N)]
#
# for _ in range(M):
#     a, b = list(map(int, input().split()))
#     G[a-1][b-1] = G[b-1][a-1] = 1
#
# pprint(sum(sum(g) for g in G) // 2)

from collections import Counter

class UnionFindBasic():
    """via https://note.nkmk.me/python-union-find/
    """
    def __init__(self, n: int):
        # < 0 は根
        self.n = n
        self.parents = [-1] * n

    def find(self, x: int) -> int:
        if self.parents[x] < 0:
            return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x: int, y: int):
        x = self.find(x)
        y = self.find(y)
        if x == y: return
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

def main():
    N, M = map(int, input().split())

    if M == 0:
        print(1)
        return

    uf = UnionFindBasic(N)

    for _ in range(M):
        a,b = list(map(lambda x: int(x)-1, input().split()))
        uf.union(a,b)

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

if __name__ == '__main__':
    main()