#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int a,now=0;
		vector<pair<int,int> > v;
		for(int i=1;i<=4;i++) cin>>a,v.push_back({a,i});
		sort(v.begin(),v.end());
		now+=v[2].second;
		now+=v[3].second;
		if(now==3||now==7) cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
}
