program Project2; {$APPTYPE CONSOLE} var f, g:text; a,i, u:integer; b:array[1..12] of int64; p:array[1..3] of boolean; procedure sort; var n, ba:int64; i,k:integer; begin for i:=1 to 11 do begin n:=i; for k:=i to 12 do if b[n]>b[k] then n:=k; end; ba:=b[i]; b[i]:=b[n]; b[n]:=ba; end; begin assign(f, 'matches.in'); reset(f); assign(g, 'matches,out'); rewrite(g); readln(f, a); FillChar(p,3,1); for i:=1 to a do begin readln(f, b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12]); sort; for u:=1 to 3 do begin if b[i]<>b[i+1] then p[1]:=false; if b[4+i]<>b[5+i] then p[2]:=false; if b[8+i]<>b(9+i] then p[3]:=false; end; if p[1] and p[2] and p[3] then writeln(g, 'yes') else writeln(g, 'no'); end; close(f); close(g); end.