class Graph(): def __init__(self,size,directed=False): self.dir=directed self.size=size self.gr=[[] for i in range(size)] self.edges=[] def add_edge(self,u,v,status={}): self.gr[u].append(self.Edge(u,v,status)) if not(self.dir): self.gr[v].append(self.Edge(v,u,status)) self.edges.append(self.Edge(u,v,status)) def node(self,v): return self.gr[v] class Edge(): def __init__(self,st,to,status): self.st=st self.to=to self.status=status def __getitem__(self,val): return self.status[val] from collections import deque def bridge(gr): pre=[-1]*gr.size low=[-1]*gr.size ret=[] for i in range(gr.size): if pre[i]!=-1: continue vert=deque([[0,i,-1,-1]]) cnt=0 while len(vert)>0: step,now,bef,ed=vert[-1] if step==1: for j in gr.node(now): if j.to!=bef: low[now]=min(low[now],low[j.to]) if ed!=-1 and pre[now]<=low[now]: ret.append(gr.node(bef)[ed]) vert.pop() continue if pre[now]!=-1: low[bef]=min(low[bef],low[now]) vert.pop() continue pre[now]=cnt low[now]=cnt cnt+=1 vert[-1][0]=1 for j,k in enumerate(gr.node(now)): if k.to==bef: continue if low[k.to]==-1: vert.append([0,k.to,now,j]) else: low[now]=min(low[now],low[k.to]) return ret class UnionFind(): def __init__(self,size): self.uf=[[-1,0,1] for i in range(size)] def unite(self,fir,sec): one=self.root(fir) two=self.root(sec) if one!=two: if self.uf[one][1]>self.uf[two][1]: one,two=two,one self.uf[one][0]=two self.uf[two][2]+=self.uf[one][2] if self.uf[one][1]==self.uf[two][1]: self.uf[two][1]+=1 def same(self,fir,sec): return self.root(fir)==self.root(sec) def root(self,node): pos=node change=[] while self.uf[pos][0]!=-1: change.append(pos) pos=self.uf[pos][0] for i in change: self.uf[i][0]=pos return pos def size(self,node): return self.uf[self.root(node)][2] N,M,Q=map(int,input().split()) namori=Graph(N) for i in range(M): u,v=map(int,input().split()) namori.add_edge(u-1,v-1) union=UnionFind(N) for i in bridge(namori): union.unite(i.st,i.to) for i in range(Q): x,y=map(int,input().split()) if union.same(x-1,y-1): print("Yes") else: print("No")