#include<bits/stdc++.h>
 
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define vi vector<int>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define ll long long
#define endl "\n"
#define MAX 1000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,s,n) for(int i=s;i<n;i++)
#define repx(i,n,x) for(int i=0;i<n;i+=x)
#define repsx(i,s,n,x) for(int i=s;i<n;i+=x)
#define deb(x) cout<<#x<<":"<<x<<"\n";
#define printloop(x) for(auto itr:x)cout<<itr<<" ";cout<<"\n";
#define printlooppair(x) cout<<#x<<":";for(auto itr:x)cout<<itr.first<<" and "<<itr.second<<" ";cout<<"\n";
#define printlooppairpair(x) cout<<#x<<":";for(auto itr:x)cout<<itr.first.first<<","<<itr.first.second<<"->"<<itr.second<<" ";cout<<"\n";
#define printtwoloop(x) for(auto i:x){cout<<#x<<":";for(auto j:i){cout<<j<<" ";}cout<<"\n";}cout<<"\n";
#define whole(x) (x).begin(),(x).end()
#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))

using namespace std;

template<typename T> istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;return is;}
template<typename T> ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' ';os<<"\n";return os;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
inline ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}


int main() {
    fast
    int t;
    cin>>t;
    while(t--){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        if((a>c && a>d && b>c && b>d) || (c>a && c>b && d>a && d>b)) cout<<"NO\n";
        else cout<<"YES\n";
    }
    
    return 0;
}