#include<bits/stdc++.h>
using namespace std;int fa[5005];intget(int x){if(x == fa[x])return x;return fa[x]=get(fa[x]);}voidmerge(int x,int y){
x =get(x);
y =get(y);if(x != y)
fa[y]= x;}intmain(){int n, m, p;
cin>>n>>m>>p;for(int i =0; i <= n; i++)
fa[i]= i;for(int i =0; i < m; i++){int a, b;scanf("%d%d",&a,&b);merge(a,b);}for(int i =0; i < p;++i){int a, b;
cin>>a>>b;if(get(a)==get(b))
cout<<"Yes"<<endl;else
cout<<"No"<<endl;}return0;}