var
  f1,f2:text;
  i,j,k,n,i1,j1:byte;
  a:array[1..3,1..2]of byte;
  b:boolean;
begin
  assign(f1,'c.in');
  reset(f1);
  assign(f2,'c.out');
  rewrite(f2);
  readln(f1,n);
  for k:=1 to n do
  begin
    for i:=1 to 3 do read(f1,a[i,1],a[i,2]);
    readln(f1);
    b:=false;
    for i:=1 to 2 do
    for j:=i+1 to 3 do
    for i1:=1 to 2 do
    for j1:=1 to 2 do
      b:=b or(a[i,i1]=a[j,j1]);
    if b then writeln(f2,'YES')
    else writeln(f2,'NO');
  end;
  close(f1);
  close(f2);
end.
