#include<stdio.h>
const int maxn = 5010;
int father[maxn];
void init(int n) {
for(int i=0; i<=n; i++) {
father[i] = i;
}
}
int findFather(int x) {
int fx = father[x];
if(fx == x) {
return fx;
}
return father[x] = findFather(fx);
}
bool isSame(int x, int y) {
int fx = findFather(x), fy = findFather(y);
return fx == fy;
}
void combile(int x, int y) {
int fx = findFather(x), fy = findFather(y);
if(fx < fy) {
father[x] = father[y] = fx;
} else {
father[x] = father[y] = fy;
}
}
int main()
{
int n, m, p, x, y;
scanf("%d%d%d", &n, &m, &p);
init(n);
for(int i=0; i<m; i++) {
scanf("%d%d", &x, &y);
combile(x, y);
}
for(int i=0; i<p; i++) {
scanf("%d%d", &x, &y);
if(isSame(x, y)) {
printf("Yes\n");
} else {
printf("No\n");
}
}
return 0;
}