program Project2; {$APPTYPE CONSOLE} uses SysUtils; var a:array[1..100,1..100] of integer;b:array[1..100,1..100] of integer;i,f,q,j,w,n:integer; input,output:text; begin assign(input,'matches.in'); assign(output,'matches.out'); reset(input); rewrite(output); readln(input,n); for i:=1 to n do begin for j:=1 to 12 do read(input,a[i,j]); end; close(input); for i:=1 to n do begin for j:=1 to 12 do begin q:=j; b[i,q]:=a[i,j]; end; end; w:=0; for i:=1 to n do begin for j:=1 to 12 do for q:=1 to 12 do if a[i,j]=b[i,q] then w:=w+1; if w mod 4=0 then f:=1 else f:=0; if f=1 then writeln(output,'yes') else writeln(output,'no'); end; close(output); end.