from collections import Counter



n,k,l=map(int,input().split())

city1=[i for i in range(n)]

city2=[i for i in range(n)]



def root(c,x):

  if x==c[x]:

    return x

  else:

    return root(c,c[x])



def union(c,x,y):

  rx=root(c,x)

  ry=root(c,y)

  if rx>ry:

    c[rx]=ry

  else:

    c[ry]=rx



for i in range(k):

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

  union(city1,a-1,b-1)

for i in range(l):

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

  union(city2,a-1,b-1)

r=[]

for i in range(n):

  r.append((root(city1,i),root(city2,i)))

c=Counter(r)

for i in range(n):

  ans=c[r[i]]

  if i==n-1:

    print(ans)

  else:

    print(ans,end=' ')

N, K, L = map(int, input().split())



par = [i for i in range(N)]



def find(x, P):

    if P[x] == x:

        return x

    else:

        b = find(P[x], P)

        P[x] = b

        return b



def unite(x, y, P):

    root_x = find(x, P)

    root_y = find(y, P)

    if root_y > root_x:

        P[root_x] = root_y

    else:

        P[root_y] = root_x



par2 = [i for i in range(N)]



for _ in range(K):

    p, q = map(int, input().split())

    unite(p-1, q-1, par)



for _ in range(L):

    p, q = map(int, input().split())

    unite(p-1, q-1, par2)

#print(par2)



r=[]

for i in range(N):

    r.append((find(i,par), find(i, par2)))



import collections

count = collections.Counter(r)

#print(count)



for i in range(N):

  ans = count[r[i]]

  if i == N-1:

    print(ans)

  else:

    print(ans, end=' ')

from collections import Counter

n, k, l = map(int, input().split())
city1 = [i for i in range(n)]
city2 = [i for i in range(n)]


def root(c, x):
    if x == c[x]:
        return x
    else:
        return root(c, c[x])


def union(c, x, y):
    rx = root(c, x)
    ry = root(c, y)
    if rx > ry:
        c[rx] = ry
    else:
        c[ry] = rx


for i in range(k):
    a, b = map(int, input().split())
    union(city1, a - 1, b - 1)
for i in range(l):
    a, b = map(int, input().split())
    union(city2, a - 1, b - 1)
r = []
for i in range(n):
    r.append((root(city1, i), root(city2, i)))
c = Counter(r)
for i in range(n):
    ans = c[r[i]]
    if i == n - 1:
        print(ans)
    else:
        print(ans, end=" ")

N, K, L = map(int, input().split())
par = [i for i in range(N)]


def find(x, P):
    if P[x] == x:
        return x
    else:
        b = find(P[x], P)
        P[x] = b
        return b


def unite(x, y, P):
    root_x = find(x, P)
    root_y = find(y, P)
    if root_y > root_x:
        P[root_x] = root_y
    else:
        P[root_y] = root_x


par2 = [i for i in range(N)]
for _ in range(K):
    p, q = map(int, input().split())
    unite(p - 1, q - 1, par)
for _ in range(L):
    p, q = map(int, input().split())
    unite(p - 1, q - 1, par2)
# print(par2)
r = []
for i in range(N):
    r.append((find(i, par), find(i, par2)))
import collections

count = collections.Counter(r)
# print(count)
for i in range(N):
    ans = count[r[i]]
    if i == N - 1:
        print(ans)
    else:
        print(ans, end=" ")

-from collections import Counter - -n, k, l = map(int, input().split()) -city1 = [i for i in range(n)] -city2 = [i for i in range(n)] +N, K, L = map(int, input().split()) +par = [i for i in range(N)] -def root(c, x): -    if x == c[x]: +def find(x, P): +    if P[x] == x: -        return root(c, c[x]) +        b = find(P[x], P) +        P[x] = b +        return b -def union(c, x, y): -    rx = root(c, x) -    ry = root(c, y) -    if rx > ry: -        c[rx] = ry +def unite(x, y, P): +    root_x = find(x, P) +    root_y = find(y, P) +    if root_y > root_x: +        P[root_x] = root_y -        c[ry] = rx +        P[root_y] = root_x -for i in range(k): -    a, b = map(int, input().split()) -    union(city1, a - 1, b - 1) -for i in range(l): -    a, b = map(int, input().split()) -    union(city2, a - 1, b - 1) +par2 = [i for i in range(N)] +for _ in range(K): +    p, q = map(int, input().split()) +    unite(p - 1, q - 1, par) +for _ in range(L): +    p, q = map(int, input().split()) +    unite(p - 1, q - 1, par2) +# print(par2) -for i in range(n): -    r.append((root(city1, i), root(city2, i))) -c = Counter(r) -for i in range(n): -    ans = c[r[i]] -    if i == n - 1: +for i in range(N): +    r.append((find(i, par), find(i, par2))) +import collections + +count = collections.Counter(r) +# print(count) +for i in range(N): +    ans = count[r[i]] +    if i == N - 1: