#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,k,l,h;
	cin>>n>>k>>l;
	int *a=new int[k+1];
	int *b=new int[k+1];
	int *c=new int[l+1];
	int *d=new int[l+1];
	for(int i=1;i<=k;i++)
	  {
	  	cin>>a[i]>>b[i];
	  }
	for(int i=1;i<=l;i++)
	  {
	  	cin>>c[i]>>d[i];
	  }  
	int *j=new int[n+1];
	for(int i=1;i<=n;i++)
	  j[i]=1;
	for(int i=1;i<=k;i++)
	  for(int z=1;z<=l;z++)
	  	{
	  	  if((a[i]==c[z]&&b[i]==d[z])||(a[i]==d[z]&&b[i]==c[z]))
			{
			  j[a[i]]=2;
			  j[b[i]]=2; 
			}        	  
		  else		
			if(a[i]==c[z]||a[i]==d[z])	
			  {
				if(a[i]==c[z])
				  h=d[z];
				else
				  h=c[z];   
				for(int s=1;s<=l;s++)
				  {
				     if(s==z)
				       break;
					 if((c[z]==h&&d[z]==b[i])||(c[z]==b[i]&&d[z]==h))
				       {
				       	  j[a[i]]=2;
			              j[b[i]]=2; 
					   }	    
				    	
				  } 
			  } 
			if(b[i]==c[z]||b[i]==d[z])
			  {
			  	if(b[i]==c[z])
				  h=d[z];
				else
				  h=c[z];   
				for(int s=1;s<=l;s++)
				  {
				     if(s==z)
				       break;
					 if((c[z]==h&&d[z]==a[i])||(c[z]==a[i]&&d[z]==h))
				       {
				       	  j[a[i]]=2;
			              j[b[i]]=2; 
					   }	    		    	
				  }  
			  }  
		  }  	
	for(int i=1;i<=n;i++)
	  cout<<j[i]<<" ";		
	return 0;
 } 