#include <iostream>

using namespace std;

int main()
{
    long int t;
    int x0,x1,x2,x3 , final1,final2,loss1,loss2;
    cin>>t;
    for(int i = 0 ; i< t;i++) {
        cin>>x0>>x1>>x2>>x3;
        if (x0>x1) {
            final1 = x0;
            loss1 = x1;
        }
        else if (x1 > x0) {
            final1 = x1;
            loss1 = x0;
        }
        if (x2>x3) {
            final2 = x2;
            loss2 = x3;
        }
        else if (x2<x3) {
            final2 = x3;
            loss2 = x2;
        }
        if (loss1 > final2 || loss2 > final1) {
            cout<<"NO"<<endl;
        }
        else {
            cout<<"YES"<<endl;
        }
    }
    return 0;
}
