<Problem>
http://ntucoder.net/Problem/Details/2202
Uses Crt;
Var st:ansistring;
n,i:longint;
a,b,temp1,temp2:int64;
Begin
readln(st);
readln(n);
for i:=1 to n do begin
readln(a,b);
temp1:=a mod length(st); if temp1=0 then temp1:=length(st);
temp2:=b mod length(st); if temp2=0 then temp2:=length(st);
if st[temp1]=st[temp2] then writeln('Yes') else writeln('No');
end;
readln;
End.