#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e3 + 9;
int fa[maxn];
int get(int x){//找到祖宗,不是的话向上递归
if (fa[x] == x) return x;
return get(fa[x]);
}
void merge(int x,int y){//合并集合
fa[get(x)] = get(y);
}
int main(){
int n,m,p;
cin >> n >> m >> p;
for(int i = 1;i <= n;i ++) fa[i] = i;
for(int i = 0;i < m;i ++){
int u,v;
cin >> u >> v;
if(get(u) != get(v)) merge(u,v);//如果不是同祖宗,合并
}
while(p--) {
int x,y;
cin >> x >> y;
if(get(x) == get(y)) cout << "Yes" << '\n';//判断是否是亲戚
else cout << "No" << "\n";
}
return 0;
}