#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
bool road[100000];
bool raw[100000];
int main()
{
	ll from,to;
	ll n,a,b;
	cin>>n>>a>>b;
	for(int i=1;i<=a;i++)
	{
		cin>>from>>to;
		road[from]=1;
		road[to]=1;
	}
	for(int i=1;i<=b;i++)
	{
		cin>>from>>to;
		raw[from]=1;
		raw[to]=1;
	}
	for(int i=1;i<=n;i++)
	{
		if(road[i]==1 && raw[i]==1)
			cout<<2<<" ";
		if(road[i]==1&&raw[i]==0 || road[i]==0&&raw[i]==1)
			cout<<1<<" ";
		if(road[i]==0&&raw[i]==0)
			cout<<0<<" ";
	}
	return 0;
}