#include <bits/stdc++.h>
#define MAXN 2000200
#define minn 1000200
using namespace std;
typedef pair<int,int> pl;//fi=long se=node
struct aa{
int operator()(const pl& a,const pl&b){return a.first>b.first;}};
priority_queue<pl,vector<pl>,aa> a;
int n,m,q;
int val[MAXN];
int ne[MAXN];
int head[MAXN];
int idx;
int ji[minn],ou[minn];
void push(int a,int hh){
val[idx]=a;
ne[idx]=head[hh];
head[hh]=idx;
idx++;
}
void dijistra(){
memset(ji,0x3f,sizeof(ji));
memset(ou,0x3f,sizeof(ou));
ou[1]=0;
a.push({0,1});
while(a.size())
{
pl e=a.top();
a.pop();
int f=head[e.second];
if(e.first%2==0)
while(f!=0)
{
if(ji[val[f]]>e.first+1)
{ji[val[f]]=e.first+1;a.push({e.first+1,val[f]});}
f=ne[f];
}
else
while(f!=0)
{
if(ou[val[f]]>e.first+1)
{ou[val[f]]=e.first+1;a.push({e.first+1,val[f]});}
f=ne[f];
}
}
}
int main()
{
cin>>n>>m>>q;
for(int i=0;i<m;i++)
{
int v,b;
cin>>v>>b;
push(v,b);
push(b,v);
}
dijistra();
for(int i=0;i<q;i++)
{
int f,g;
cin>>f>>g;
if(g>=ou[f]&&g%2==0) cout<<"Yes"<<endl;
else if(g>=ji[f]&&g%2==1) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
调了好久都调不出,求大佬救救