#include<iostream>
#include<cstring>
using namespace std;
int main()
{
 int t;
 cin>>t;
 for(int i=0;i<t;i++)
 {int s1,s2,s3,s4;
 cin>>s1>>s2>>s3>>s4;
 if((s1<s3 && s2<s3 && s1<s4&& s2<s4)||(s1>s3 && s2>s3 && s1>s4 && s2>s4))
{cout<<"NO"<<endl;
}
else{cout<<"YES"<<endl;}
}
return 0;
}
