#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);
#define endl '\n'
#define fo(i, x, y) for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y) for (__typeof(x) i = x; i > y; i--)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define vdp(n, x) vector<vector<ll>> dp(n + 1, vector<ll>(x + 1));
ll mod = 1000000007;
const ll AM = 2e5 + 5;
int main()
{
  Boost;
  int t;
  cin >> t;
  //t = 1;
  while (t--)
  {
    vector<int> v;
    fo(i, 0, 4)
    {
      int a;
      cin >> a;
      v.pb(a);
    }
    int f1 = MAX(v[0], v[1]);
    int f2 = MAX(v[2], v[3]);
    sort(v.begin(), v.end());
    if (f2 > f1)
      swap(f1, f2);
    if (f1 == v[3] && f2 == v[2])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}