Buggy python submission (verdict: Runtime Error):
import sys

ans=0
g=[]
n=0
input()
for s in sys.stdin:
    x=set()
    d=[]
    for a in s.split():
        x.add(a)
        for i in range(len(g)):
            if a in g[i]:
                d+=[i]
                x|=g[i]
    for i in d:
        del g[i]
    g.append(x)

if g:
    print(max(len(t) for t in g))
else:
    print(0)



Fixed submission:
import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys

ans=0
g=set()
input()
for s in sys.stdin:
    for a in s.split():
        for u in [*g]:
            if a in u:
                g.discard(u)
                s+=u
    g.add(s)

print(max(len(set(t.split())) for t in g))



Fixed submission:
import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys

ans=0
g=set()
input()
for s in sys.stdin:
    for a in s.split():
        for u in [*g]:
            if a in u:
                g.discard(u)
                s+=u
    g.add(s)

print(max(len(set(t.split())) for t in g))



Fixed submission:
import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)

Buggy python submission (verdict: Runtime Error):
import sys

ans=0
g=[]
input()
for s in sys.stdin:
    for a in s.split():
        for u in g:
            if a in u:
                s+=u
    g+=[s]


print(max(len(set(t.split())) for t in g))



Fixed submission:
import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)