program Main;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var  i:integer;
  n,ps,zs,ls,prs,vs,ns:byte;

BEGIN
  assign(input,'C.in');
  reset(input);
  assign(output,'C.out');
  rewrite(output);

  readln(n);

  for i:=1 to n do begin
    readln(ps,zs,ls,prs,vs,ns);
    if (ps=ls) or (ps=prs) or (ps=vs) or (ps=ns) or
       (zs=ls) or (zs=prs) or (zs=vs) or (zs=ns) or
       (ls=vs) or (ls=ns) or
       (prs=vs) or (prs=ns) then
    writeln('YES')
    else writeln('NO');


  end;

  close(output);
END.
