program Project2; {$APPTYPE CONSOLE} var a:array[1..12]of integer; var i,j,k,n,t,kk,nn:integer; b:array[1..12] of integer; p:boolean; begin assign(Input,'matches.in'); reset(Input); assign(Output,'matches.out'); rewrite(Output); readln(nn); for kk:=1 to nn do begin //!!!!!!!!!!!!!!! for j:=1 to 12 do read(a[j]); k:=1; j:=1; while k<=12 do begin n:=0; if a[k]<>-1 then begin t:=a[k]; for i:=1 to 12 do if a[i]=t then begin inc(n); a[i]:=-1;end; b[j]:=n; inc(j); end; inc(k); end; p:=true; for i:=1 to j-1 do if (b[i] mod 4) <>0 then p:=false; if p then writeln('yes') else writeln('no'); readln; end; close(Input); close(Output); end.