import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto a = readln.splitter.map !(to !(int)).array;
		writeln (min (a[0], a[1]) < max (a[2], a[3]) &&
		    min (a[2], a[3]) < max (a[0], a[1]) ? "YES" : "NO");
	}
}
