PROGRAM subsequence;//COGS1610;
CONST
fin='subsequence.in';
fout='subsequence.out';
TYPE
bb=string[53];
VAR
a:array[1..100005]of char;
b:bb;
i,m,l,lb:longint;
FUNCTION pei:boolean;
var i,j:longint;
begin
j:=0;
for i:=1 to lb do
begin
repeat
inc(j);
if a[j]=b[i] then break;
until j>l;
if j>l then exit(false);
End;
exit(true);
End;
BEGIN
assign(input,fin);reset(input);
assign(output,fout);rewrite(output);
l:=0;
repeat
inc(l);
read(a[l]);
until eoln;
readln;
readln(m);
for i:=1 to m do
begin
readln(b);
lb:=length(b);
if pei then writeln('Yes')
else writeln('No');
End;
close(output);
END.