#include <bits/stdc++.h>

#define mem(a, b)      memset(a, b, sizeof(a))
#define nl             '\n'
#define mod            1000000007
#define mod1           998244353
#define pb             push_back
#define mp             make_pair
#define min(a,b)       ((a)<(b)?(a):(b))
#define max(a,b)       ((a)>(b)?(a):(b))
#define INF            1e18
#define ff             first
#define ss             second
#define ppb            pop_back
#define sz(x)          ((int)(x).size())
#define all(x)         (x).begin(), (x).end()
#define sum(A)         accumulate(A.begin(), A.end(), 0)
#define fr(i, s, e)    for(int i = s; i < e; i++)

using namespace std;

typedef vector<int> vec;
typedef vector<long long> vecl;
typedef long long ll;

#ifndef ONLINE_JUDGE
#define dbg(x) cerr << #x <<" "; out(x); cerr << endl
#else
#define dbg(x);
#endif
 
void out(ll t) {cerr << t;}
void out(int t) {cerr << t;}
void out(string t) {cerr << t;}
void out(char t) {cerr << t;}
void out(double t) {cerr << t;}
 
template <class T, class V> void out(pair <T, V> p);
template <class T> void out(vector <T> v);
template <class T> void out(set <T> v);
template <class T, class V> void out(map <T, V> v);
template <class T> void out(multiset <T> v);
template <class T, class V> void out(pair <T, V> p) {cerr << "{"; out(p.ff); cerr << ","; out(p.ss); cerr << "}";}
template <class T> void out(vector <T> v) {cerr << "[ "; for (T i : v) {out(i); cerr << " ";} cerr << "]";}
template <class T> void out(set <T> v) {cerr << "[ "; for (T i : v) {out(i); cerr << " ";} cerr << "]";}
template <class T> void out(multiset <T> v) {cerr << "[ "; for (T i : v) {out(i); cerr << " ";} cerr << "]";}
template <class T, class V> void out(map <T, V> v) {cerr << "[ "; for (auto i : v) {out(i); cerr << " ";} cerr << "]";}

/*________________________________________________*/

vecl sieve(ll n){vector<bool> prime(n+1, true); for (ll p = 2; p * p <= n; p++) if (prime[p] == true) for (ll i = p * p; i <= n; i += p) prime[i] = false; vecl v;
for (ll p = 2; p <= n; p++){if (prime[p]) v.pb(p);} return v;}
ll gcd(ll a, ll b){ if(b == 0){ return a;} return gcd(b, a%b);}
ll nCr(int n, int r){ll p = 1, k = 1;if (n - r < r) {r = n - r;} if (r != 0) {while (r) {p *= n;k *= r; ll m = gcd(p, k);p /= m;k /= m;n--;r--;}}else {p = 1;} return p;}
void google(int x){cout << "Case #" << x << ": ";}
ll nfactors(ll x){ll ans = 1; int i = 2; while(i*i <= x){int count = 0; while(x%i == 0){x = x/ i; count++;} if(count > 0){ ans *= (count + 1);} i++;} if(x > 1){ans *= 2;}return ans;}

/*________________________________________________*/

void solve(){

	int t;
	cin >> t;
	
	while(t--){

		int s[4], fin[4];
		for(int i = 0 ; i< 4; i++){
			cin >> s[i];
			fin[i] = s[i];
		}

		sort(s, s + 4);
		int ind1 = find(fin, fin + 4, s[3]) - fin;
		int ind2 = find(fin, fin + 4, s[2]) - fin;

		dbg(ind1);
		dbg(ind2);
		if(ind1 >= 2 && ind2 >= 2){
			cout << "NO" << nl;
		}
		else if(ind1 < 2 && ind2 < 2){
			cout << "NO" << nl;
		}
		else{
			cout << "YES" << nl;
		}
	}
	
}

int main(){

	#ifndef ONLINE_JUDGE
	freopen("inputf.txt", "r", stdin);
	freopen("outputf.txt", "w", stdout);
	freopen("errorf.txt", "w", stderr);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

} 	