Buggy python submission (verdict: Time Limit Exceeded):
from queue import deque
N,M=map(int, input().split())
f=deque()
x=deque()
mx=0
for _ in range(M):
    a,b = map(int, input().split())
    for i in f:
        if a in i[0]:
            if b not in i[0]:
                i[0].add(b)
                i[1]+=1
                mx=max(mx,i[1])
            break
        elif b in i[0]:
            i[0].add(a)
            i[1]+=1
            mx=max(mx,i[1])
            break
    else:
        f.append([set((a,b)),2])
        mx=max(mx,2)

if M == 0:
    mx = 1
print(mx)


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

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

    def union(self, x, y):
        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 same(self, x, y):
        return self.find(x) == self.find(y)

N,M=map(int, input().split())
mx=0
uf = UnionFind(N+1)
for i in range(M):
	a,b = map(int, input().split())
	uf.union(a,b)
for i in uf.parents:
	mx = max(mx, uf.size(i))
if M == 0:
	mx = 1
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
f=[]
for _ in range(M):
    a,b = map(int, input().split())
    for i in f:
        if a in i or b in i:
            i.add(a)
            i.add(b)
            break
    else:
        f.append(set((a,b)))

x = 0
for i in f:
    x=max(x,len(i))
if M == 0:
    x = 1
print(x)


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

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

    def union(self, x, y):
        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 same(self, x, y):
        return self.find(x) == self.find(y)

N,M=map(int, input().split())
mx=0
uf = UnionFind(N+1)
for i in range(M):
	a,b = map(int, input().split())
	uf.union(a,b)
for i in uf.parents:
	mx = max(mx, uf.size(i))
if M == 0:
	mx = 1
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
f=[]
for i in range(M):
    a,b = map(int, input().split())
    for i in f:
        if a in i or b in i:
            i.add(a)
            i.add(b)
            break
    else:
        f.append(set((a,b)))

x = 0
for i in f:
    x=max(x,len(i))
if M == 0:
    x = 1
print(x)


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

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

    def union(self, x, y):
        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 same(self, x, y):
        return self.find(x) == self.find(y)

N,M=map(int, input().split())
mx=0
uf = UnionFind(N+1)
for i in range(M):
	a,b = map(int, input().split())
	uf.union(a,b)
for i in uf.parents:
	mx = max(mx, uf.size(i))
if M == 0:
	mx = 1
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
f=[]
for i in range(M):
    a,b = map(int, input().split())
    for i in f:
        if a in i or b in i:
            i.add(a)
            i.add(b)
            break
    else:
        f.append(set((a,b)))

x = 0
for i in f:
    x=max(x,len(i))
if M == 0:
    x = 1
print(x)


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

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

    def union(self, x, y):
        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 same(self, x, y):
        return self.find(x) == self.find(y)

N,M=map(int, input().split())
mx=0
uf = UnionFind(N+1)
for i in range(M):
	a,b = map(int, input().split())
	uf.union(a,b)
for i in uf.parents:
	mx = max(mx, uf.size(i))
if M == 0:
	mx = 1
print(mx)