#include<iostream>
using namespace std;
int father[5005];
int n,m,p,x,y;
int find(int x)
{
if (father[x]!=x) father[x]=find(father[x]);
return father[x];
}
void un(int x, int y)
{
x=find(x); y=find(y);
father[y]=x;
}
bool judge(int x, int y)
{
x=find(x); y=find(y);
if(father[x]==father[y]) return true;
else return false;
}
int main()
{
cin>>n>>m>>p;
for (int i=1; i<=n; i++)
{
father[i]=i;
}
for (int i=1; i<=m; i++)
{
cin>>x>>y;
un(x,y);
}
for (int i=1; i<=p; i++)
{
cin>>x>>y;
if(judge(x,y))
{
cout<<"Yes"<<endl;
} else
{
cout<<"No"<<endl;
}
}
return 0;
}