var maxx,n,t,cas,i,j,k,m:longint; f,f1:array[-2010..2010] of longint; w:array[0..21] of longint; begin read(t); for cas:=1 to t do begin read(n);maxx:=0; for i:=1 to n do begin read(w[i]);inc(maxx,w[i]);end; fillchar(f,sizeof(f),0); f[0]:=1; for i:=1 to n do begin f1:=f; for j:=maxx downto -maxx+w[i] do if f[j-w[i]]=1 then f[j]:=1; for j:=-maxx to maxx-w[i] do if f1[j+w[i]]=1 then f1[j]:=1; for j:=-maxx to maxx do f[j]:=f[j] or f1[j]; end; read(m); for i:=1 to m do begin read(k); if (k>=-maxx)and(k<=maxx)and((f[k]=1)or(f[-k]=1)) then writeln('YES') else writeln('NO'); end; end; end.