#include<cstdio>
#include<queue>
#include<climits>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<ctype.h>
#include<set>
#include<vector>
#include<map>
#include<time.h>
#include<list>
#include<stack>
#include<iostream>
using namespace std;
#define mod 1000000007
#define mem(x,k ) memset(x, (k) ,sizeof(x))
#define mp(A, B) make_pair(A, B)
#define pb push_back
#define sca scanf
#define pri printf
#define fi first
#define se second

typedef long long LL;
typedef long double LD;
typedef pair< int , int  > pii;

const LL INFLL=0x3f3f3f3f3f3f3f3fll;
const int INF=0x7fffffff;
const double PI=acos(-1.0);
const double  eps=1e-9;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
int n,m,k;
map < pair<int,int >,bool > M;
int f[200005];
int G[200005];
int Father(int k)
{
    if (k==f[k]) return k;
	return f[k]=Father(f[k]);
}

void Union(int x,int y)
{
    if (Father(x)==Father(y)) return;
    else
    {
        G[ f[y] ]+=G[ f [x] ];
        f[ f[x] ]=f[y];
        return;
    }
}

int main(){
    scanf("%d%d%d",&n,&k,&m);
    for (int i=1;i<=n;i++){
        f[i]=i;
        G[i]=1;
    }
    for (int i=1;i<=k;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        M[make_pair( min(u,v),max(u,v)) ]=1;
    }
    for (int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        if (M[make_pair( min(u,v),max(u,v)) ])
        Union(u,v);
    }
    for (int i=1;i<=n;i++){
        printf("%d ",G[ f[i] ]);
    }
    printf("\n");
    return 0;
}



