var a:array[1..10,1..6] of integer;
    b:array[1..10,1..10] of integer;
    n,i,j,x,s:integer;
    c:string; 
begin
assign(input,'c.in');
assign(output,'c.out');
reset(input);
rewrite(output);
read(n);
For i:=1 to n do
   For j:=1 to 10 do
      b[i,j]:=0;
  
For i:=1 to n do
   For j:=1 to 6 do
      read(a[i,j]);
For i:=1 to n do
   For j:=1 to 6 do begin
      s:=a[i,j];
      inc(b[i,s]);
      end;
For i:=1 to n do begin
   c:='no';
   x:=1;
   j:=1;
   while (c='no') and (j<=10) do begin
      If b[i,j]>2 then c:='yes' else
         If b[i,j]<2 then c:='no' else
         repeat
            If (a[i,x]=a[i,x+1]) and (a[i,x]=j) then c:='no' else c:='yes';
            x:=x+2;
         until (x=5) or (c='no');
       inc(j);
      end;
   writeln(c);
   end;
close(input);
close(output);
end.

  
          
  
      