program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  f1,f2: textfile;
  n,i: integer;
  s: array [1..6] of integer;

begin
  assignfile(f1,'C.in');
  assignfile(f2,'C.out');
  reset(f1);
  rewrite(f2);
  readln(f1,n);
  for i:=1 to n do
  begin
    readln(f1,s[1],s[2],s[3],s[4],s[5],s[6]);
    if ((s[1]=s[3])or(s[1]=s[5])or(s[1]=s[4])or(s[1]=s[6])or
       (s[2]=s[4])or(s[2]=s[5])or(s[2]=s[3])or(s[2]=s[6])or
       (s[3]=s[5])or(s[3]=s[6])or(s[4]=s[5])or(s[4]=s[6])) then writeln(f2,'YES')
    else writeln(f2,'NO');
  end;
  closefile(f1);
  closefile(f2);
end.
 