import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		Scanner in=new Scanner(new FileReader("C.in"));
		 int n=in.nextInt();
		 PrintWriter out=new PrintWriter(new FileWriter("C.out"));
		 for (int i=0;i<n;i++) 
		 {
			 int a=in.nextInt();
			 int b=in.nextInt();
			 int c=in.nextInt();
			 int d=in.nextInt();
			 int e=in.nextInt();
			 int f=in.nextInt();
			 boolean ok=false;
			 if (a==c || a==d || a==e || a==f ) ok=true;
			 if (b==c || b==d || b==e || b==f ) ok=true;
			 if (c==e || a==f ) ok=true;
			 if (d==e || d==f ) ok=true;
			 if (ok) out.println("YES"); 
			 else out.println("NO");
		 }
		 
		 in.close();
		 

		 out.close();
	}

}
