var
s,s1,s2,ans:ansistring;
l1,l2,a,m,w:longint;
begin
assign(input,'Jiahao3.in');
assign(output,'Jiahao3.out');
reset(input);
rewrite(output);
readln(s);
readln(m);
for m:=1 to m do
begin
ans:='No';
l1:=length(s);
readln(s1);
l2:=length(s1);
if l2<=l1 then
begin
s2:='';
for a:=1 to l2 do
s2:=s2+s[a];
while a<>length(s)+1 do
begin
if s2=s1 then
begin
ans:='Yes';
delete(s,a-l2+1,l2);
{writeln(length(s));}
a:=a-l2+1;
s2:='';
l1:=length(s);
if a+l2-1<=l1 then
for a:=a to a+l2-1 do
s2:=s2+s[a];
{writeln(s2);}
end
else
if a=length(s) then break
else
begin
inc(a);
delete(s2,1,1);
s2:=s2+s[a];
end;
if l1<=l2 then break;
end;
end;
{writeln(s);}
writeln(ans);
end;
close(input);close(output);
end.