var t,w,n,i,j,m:longint; a,p:array[1..25] of longint; f:array[-200..3000] of longint; x:int64; begin readln(t); for w:=1 to t do begin readln(n); fillchar(f,sizeof(f),0); fillchar(p,sizeof(p),0); for i:=1 to n do read(a[i]); f[0]:=n+1; for i:=1 to n do for j:=0 to 2000 do if (f[j]<>0)and(f[j]<>i) then begin if f[j+a[i]]=0 then f[j+a[i]]:=i; if f[j-a[i]]=0 then f[j-a[i]]:=i; end; readln(m); for i:=1 to m do begin readln(x); if (x<0)or(x>3000) then writeln('NO') else if f[x]<>0 then writeln('YES') else writeln('NO'); end; end; end.