import java.io.*;
import java.util.*;

public class Main
{
   public static void main(String[] args) throws IOException {
      Scanner in = new Scanner(new FileReader("C.in"));
      PrintWriter out = new PrintWriter(new FileWriter("C.out"),true);

int n=in.nextInt();
int a[][]=new int[n][6];
int b[]=new int[n];

for(int i=0; i<n; i++){
b[i]=0;
for(int j=0; j<6; j++){
a[i][j]=in.nextInt();
}
}

for(int i=0; i<n; i++){
 for(int j=0; j<4; j++){
   if(j==0||j==2){
    for(int l=j+2; l<6; l++){
     if(a[i][j]==a[i][l])  ++b[i];
    }
   }
   else if(j==1||j==3){
    for(int l=j+1; l<6; l++){
     if(a[i][j]==a[i][l])  ++b[i];
    }
   }
 }
}
 
for(int i=0; i<n; i++){
if(b[i]>0) out.println("YES");
else out.println("NO");
}

}
}
