#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=2e5+100;
const int M=4e5+100;
int head1[N],ver1[M],Next1[M];
int tot1,tot2;
int add1(int x,int y)
{
	ver1[++tot1]=y;
	Next1[tot1]=head1[x];
	head1[x]=tot1;
}

int head2[N],ver2[M],Next2[M];
int add2(int x,int y)
{
	ver2[++tot2]=y;
	Next2[tot2]=head2[x];
	head2[x]=tot2;
}
int cnt=0;
int c1[N],c2[N];
void dfs1(int x)
{
	c1[x]=cnt;
	for(int i=head1[x];i;i=Next1[i])
	{
		int y=ver1[i];
		if(c1[y])continue;
		dfs1(y);
	}
}
void dfs2(int x)
{
	
	c2[x]=cnt;
	for(int i=head2[x];i;i=Next2[i])
	{
		int y=ver2[i];
		
		if(c2[y])continue;
		dfs2(y);
	}
}

map<pair<int,int>,int>MM;
int main()
{
	int n,k,l;
	while(cin>>n>>k>>l)
	{
		MM.clear();
		memset(head1,0,sizeof(head1));
		memset(ver1,0,sizeof(ver1));
		memset(Next1,0,sizeof(Next1));
		memset(head2,0,sizeof(head2));
		memset(ver2,0,sizeof(ver2));
		memset(Next2,0,sizeof(Next2));
		memset(c1,0,sizeof(c1));
		memset(c2,0,sizeof(c2));
		tot1=0;
		tot2=0;
		for(int i=1;i<=k;i++)
		{
			int x,y;
			cin>>x>>y;
			add1(x,y);
			add1(y,x);
		}
		
		for(int i=1;i<=l;i++)
		{
			int x,y;
			cin>>x>>y;
			add2(x,y);
			add2(y,x);
		}
		for(int i=1;i<=n;i++)
		{
			if(c1[i]==0)
			{
				cnt++;
				dfs1(i);
			}
		}
		cnt=0;
		for(int i=1;i<=n;i++)
		{
			if(c2[i]==0)
			{
				cnt++;
				dfs2(i);
			}
		}
		
		for(int i=1;i<=n;i++)
			MM[make_pair(c1[i],c2[i])]++;
		for(int i=1;i<=n;i++)
		{
			cout<<MM[make_pair(c1[i],c2[i])]<<" ";
			if(i==n)cout<<endl;
		}
		
	}
	return 0;
} 
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
    ll N,M,Q;
    cin >> N >> M >> Q;
    vvl cnt(N+1,vl(N+1,0));
    rep(i,M){
        ll L,R;
        cin >> L >> R;
        cnt[L][R]++;
    }
    FOR(i,0,N+1){
        FOR(j,1,N+1){
            cnt[i][j]+=cnt[i][j-1];
        }
    }
    FOR(i,1,N+1){
        FOR(j,0,N+1){
            cnt[i][j]+=cnt[i-1][j];
        }
    }
    rep(i,Q){
        ll p,q;
        cin >> p >> q;
        p--;
        cout << cnt[p][p]+cnt[q][q]-cnt[p][q]-cnt[q][p] << endl;
    }
}