program task_b; {$APPTYPE CONSOLE} uses SysUtils; var n,k,i,j:longint; a:array[1..12] of int64; ans:array[1..100] of integer; f:text; b:boolean; procedure QSort(l,r:longint); var buf:int64; key,i,j:longint; begin if (lkey) do dec(j); if (i<=j) then begin buf:=a[i]; a[i]:=a[j]; a[j]:=buf; inc(i); dec(j); end; end; QSort(l,j); QSort(i,r); end; end; begin fillchar(ans,sizeof(ans),0); assign(f,'matches.in'); reset(f); readln(f,n); writeln(n); for i:=1 to n do begin for j:=1 to 12 do read(f,a[j]); readln(f); QSort(1,12); b:=true; k:=a[1]; for j:=1 to 4 do begin if (a[j]<>k) then b:=false; end; k:=a[5]; for j:=5 to 8 do begin if (a[j]<>k) then b:=false; end; k:=a[9]; for j:=9 to 12 do begin if (a[j]<>k) then b:=false; end; if (b) then ans[i]:=1; end; close(f); assign(f,'matches.out'); rewrite(f); for i:=1 to n do begin if (ans[i]=1) then writeln(f,'yes') else writeln(f,'no'); end; close(f); { TODO -oUser -cConsole Main : Insert code here } end.