Buggy python submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, length):
        self.r = [-1] * length

    def root(self, x):
        if (self.r[x]) < 0:
            return x

        return self.r[x] - self.root(self.r[x])

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return False
        r = self.r

        if r[x] > r[y]:
            x, y = y, x

        r[x] += r[y]
        r[y] = x

        return True

    def size(self, x):
        return -self.r[self.root(x)]


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


relateions = UnionFind(N)
for _ in range(M):
    A, B = map(int, input().split())
    relateions.unite(A-1, B-1)

max_ = -1
for i in range(N):
    max_ = max(relateions.size(i), max_)

print(max_)


Fixed submission:
class UnionFind:
    def __init__(self, length):
        self.r = [-1] * length

    def root(self, x):
        rx = self.r[x]
        if (rx) < 0:
            return x

        return self.root(rx)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return False
        r = self.r

        if r[x] > r[y]:
            x, y = y, x

        r[x] += r[y]
        r[y] = x

        return True

    def size(self, x):
        return -self.r[self.root(x)]

    def debug(self):
        print(self.r)


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


relations = UnionFind(N)
for _ in range(M):
    A, B = map(int, input().split())
    relations.unite(A-1, B-1)

max_ = -1
for i in range(N):
    max_ = max(relations.size(i), max_)

print(max_)

Buggy python submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, length):
        self.r = [-1] * length

    def root(self, x):
        if (self.r[x]) < 0:
            return x

        return self.r[x] - self.root(self.r[x])

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return False
        r = self.r

        if r[x] > r[y]:
            x, y = y, x

        r[x] += r[y]
        r[y] = x

        return True

    def size(self, x):
        return -self.r[self.root(x)]


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


relateions = UnionFind(N)
for _ in range(M):
    A, B = map(int, input().split())
    relateions.unite(A, B)

max_ = -1
for i in range(N):
    max_ = max(relateions.size(i), max_)

print(max_)


Fixed submission:
class UnionFind:
    def __init__(self, length):
        self.r = [-1] * length

    def root(self, x):
        rx = self.r[x]
        if (rx) < 0:
            return x

        return self.root(rx)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return False
        r = self.r

        if r[x] > r[y]:
            x, y = y, x

        r[x] += r[y]
        r[y] = x

        return True

    def size(self, x):
        return -self.r[self.root(x)]

    def debug(self):
        print(self.r)


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


relations = UnionFind(N)
for _ in range(M):
    A, B = map(int, input().split())
    relations.unite(A-1, B-1)

max_ = -1
for i in range(N):
    max_ = max(relations.size(i), max_)

print(max_)