import sys

from collections import defaultdict

import numpy as np

from scipy.sparse import csr_matrix

from scipy.sparse.csgraph import connected_components



input = sys.stdin.buffer.readline

read = sys.stdin.buffer.read



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

pq_and_rs = list(map(int, read().split()))



ps = pq_and_rs[:2*K:2]

qs = pq_and_rs[1:2*K:2]

rs = pq_and_rs[2*K::2]

ss = pq_and_rs[2*K+1::2]



pq_adj = csr_matrix(([1] * (2 * K), (ps + qs, qs + ps)), shape=(N+1, N+1))

rs_adj = csr_matrix(([1] * (2 * L), (rs + ss, ss + rs)), shape=(N+1, N+1))



group = ((connected_components(pq_adj)[1].astype(np.int64) << 32) + connected_components(rs_adj)[1]).tolist()

group_to_elements = defaultdict(list)

for v, g in enumerate(group):

    group_to_elements[g].append(v)



for v in range(1, N+1):

    print((len(group_to_elements[group[v]])))
import sys

from collections import Counter

input = sys.stdin.buffer.readline





def grouping(adj):

    "0-indexed の無向グラフを連結成分に分解する。"

    n = len(adj)

    ret = [-1] * n

    g = 0

    for v in range(n):

        if ret[v] == -1:

            ret[v] = g

            stack = [v]

            while stack:

                v = stack.pop()

                for nv in adj[v]:

                    if ret[nv] == -1:

                        ret[nv] = ret[v]

                        stack.append(nv)

            g += 1

    return ret





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



pq_adj = [[] for _ in range(N)]

for _ in range(K):

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

    p -= 1

    q -= 1

    pq_adj[p].append(q)

    pq_adj[q].append(p)



rs_adj = [[] for _ in range(N)]

for _ in range(L):

    r, s = list(map(int, input().split()))

    r -= 1

    s -= 1

    rs_adj[r].append(s)

    rs_adj[s].append(r)





group = [(g1 << 32) + g2 for g1, g2 in zip(grouping(pq_adj), grouping(rs_adj))]

c = Counter(group)

for v in range(N):

    print((c[group[v]]))
import sys
from collections import defaultdict
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
N, K, L = list(map(int, input().split()))
pq_and_rs = list(map(int, read().split()))
ps = pq_and_rs[: 2 * K : 2]
qs = pq_and_rs[1 : 2 * K : 2]
rs = pq_and_rs[2 * K :: 2]
ss = pq_and_rs[2 * K + 1 :: 2]
pq_adj = csr_matrix(([1] * (2 * K), (ps + qs, qs + ps)), shape=(N + 1, N + 1))
rs_adj = csr_matrix(([1] * (2 * L), (rs + ss, ss + rs)), shape=(N + 1, N + 1))
group = (
    (connected_components(pq_adj)[1].astype(np.int64) << 32)
    + connected_components(rs_adj)[1]
).tolist()
group_to_elements = defaultdict(list)
for v, g in enumerate(group):
    group_to_elements[g].append(v)
for v in range(1, N + 1):
    print((len(group_to_elements[group[v]])))

import sys
from collections import Counter

input = sys.stdin.buffer.readline


def grouping(adj):
    "0-indexed の無向グラフを連結成分に分解する。"
    n = len(adj)
    ret = [-1] * n
    g = 0
    for v in range(n):
        if ret[v] == -1:
            ret[v] = g
            stack = [v]
            while stack:
                v = stack.pop()
                for nv in adj[v]:
                    if ret[nv] == -1:
                        ret[nv] = ret[v]
                        stack.append(nv)
            g += 1
    return ret


N, K, L = list(map(int, input().split()))
pq_adj = [[] for _ in range(N)]
for _ in range(K):
    p, q = list(map(int, input().split()))
    p -= 1
    q -= 1
    pq_adj[p].append(q)
    pq_adj[q].append(p)
rs_adj = [[] for _ in range(N)]
for _ in range(L):
    r, s = list(map(int, input().split()))
    r -= 1
    s -= 1
    rs_adj[r].append(s)
    rs_adj[s].append(r)
group = [(g1 << 32) + g2 for g1, g2 in zip(grouping(pq_adj), grouping(rs_adj))]
c = Counter(group)
for v in range(N):
    print((c[group[v]]))

-from collections import defaultdict -import numpy as np -from scipy.sparse import csr_matrix -from scipy.sparse.csgraph import connected_components +from collections import Counter -read = sys.stdin.buffer.read + + +def grouping(adj): +    "0-indexed の無向グラフを連結成分に分解する。" +    n = len(adj) +    ret = [-1] * n +    g = 0 +    for v in range(n): +        if ret[v] == -1: +            ret[v] = g +            stack = [v] +            while stack: +                v = stack.pop() +                for nv in adj[v]: +                    if ret[nv] == -1: +                        ret[nv] = ret[v] +                        stack.append(nv) +            g += 1 +    return ret + + -pq_and_rs = list(map(int, read().split())) -ps = pq_and_rs[: 2 * K : 2] -qs = pq_and_rs[1 : 2 * K : 2] -rs = pq_and_rs[2 * K :: 2] -ss = pq_and_rs[2 * K + 1 :: 2] -pq_adj = csr_matrix(([1] * (2 * K), (ps + qs, qs + ps)), shape=(N + 1, N + 1)) -rs_adj = csr_matrix(([1] * (2 * L), (rs + ss, ss + rs)), shape=(N + 1, N + 1)) -group = ( -    (connected_components(pq_adj)[1].astype(np.int64) << 32) -    + connected_components(rs_adj)[1] -).tolist() -group_to_elements = defaultdict(list) -for v, g in enumerate(group): -    group_to_elements[g].append(v) -for v in range(1, N + 1): -    print((len(group_to_elements[group[v]]))) +pq_adj = [[] for _ in range(N)] +for _ in range(K): +    p, q = list(map(int, input().split())) +    p -= 1 +    q -= 1 +    pq_adj[p].append(q) +    pq_adj[q].append(p) +rs_adj = [[] for _ in range(N)] +for _ in range(L): +    r, s = list(map(int, input().split())) +    r -= 1 +    s -= 1 +    rs_adj[r].append(s) +    rs_adj[s].append(r) +group = [(g1 << 32) + g2 for g1, g2 in zip(grouping(pq_adj), grouping(rs_adj))] +c = Counter(group) +for v in range(N): +    print((c[group[v]]))