#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
using namespace std;
#define scand(n) scanf("%d",&n)
#define scandd(n,m) scanf("%d%d",&n,&m)
#define scanddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define scans(u) scanf("%s",u)
typedef long long ll;
const int MAXN= 200005;
int fa[MAXN];
int fa2[MAXN];
int faf(int x)
{
    if(fa[x]==x)return x;
    else return fa[x]=faf(fa[x]);
}
void un(int a,int b)
{
    int f1=faf(a),f2=faf(b);
    if(f1!=f2)fa[f2]=f1;
}
int faf2(int x)
{
    if(fa2[x]==x)return x;
    else return fa2[x]=faf(fa2[x]);
}
void un2(int a,int b)
{
    int f1=faf2(a),f2=faf2(b);
    if(f1!=f2)fa2[f2]=f1;
}
int ans[MAXN];
int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
#endif

    int n,k,l;
    scanddd(n,k,l);
    for(int i=1;i<=n;++i)fa[i]=i,fa2[i]=i;
    for(int i=1;i<=k;++i)
    {
        int a,b;
        scandd(a,b);
        un(a,b);
    }
    for(int i=1;i<=l;++i)
    {
        int a,b;
        scandd(a,b);
        if(faf(a)==faf(b))
        {
            ans[a]++;
            ans[b]++;
        }

    }
    for(int i=1;i<=n;++i)
    printf("%d ",ans[i]+1);
    return 0;
}
