#include <iostream>
#include <cstdio>
using namespace std;

int a[6];

bool check(){
   for(int i = 2 ; i < 6 ;i++){
     if (a[i] == a[0] || a[i] == a[1])
       return true;
   }
   for(int i = 4; i < 6 ;i++  ){
     if (a[i] == a[2] || a[i] == a[3])
       return true;
   }
   return false;
}
int main(){
  freopen("C.in","r",stdin);
  freopen("C.out","w",stdout);
  int n;
  cin>>n;
  for(int i = 0; i < n ;i++){
    for(int j = 0 ; j < 6 ;j++){
       cin>>a[j];
    } 
    if (check()) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  } 
  return 0;
}