#include<iostream> using namespace std; int id[100001],si[100001]; int ifind(int p){ while(p!=id[p]){ id[p]=id[id[p]];//父节点为爷爷节点,路径压缩 p=id[p]; } return p; } void iunion(int p,int q){ int i=ifind(p); int j=ifind(q); if(i==j) return; if(si[i]<si[j]){ id[i]=j; si[j]+=si[i]; }else{ id[j]=i; si[i]+=si[j]; } } int main(){ int n,m,p; while(cin>>n>>m>>p){ for(int i=1;i<=n;i++){ id[i]=i; si[i]=1; } int ai,bi; for(int i=1;i<=m;i++){ cin>>ai>>bi; iunion(ai,bi); } for(int i=1;i<=p;i++){ cin>>ai>>bi; if(ifind(ai)==ifind(bi)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } return 0; }