Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament.

It is known that in a match between two players, the one whose skill is greater will win. The skill of the i-th player is equal to s_i and all skill levels are pairwise different (i. e. there are no two identical values in the array s).

The tournament is called fair if the two players with the highest skills meet in the finals.

Determine whether the given tournament is fair.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases.

A single line of test case contains four integers s_1, s_2, s_3, s_4 (1 ≤ s_i ≤ 100) — skill of the players. It is guaranteed that all the numbers in the array are different.

Output

For each testcase, output YES if the tournament is fair, or NO otherwise.

Example

Input


4
3 7 9 5
4 5 6 9
5 3 8 1
6 5 3 2


Output


YES
NO
YES
NO

Note

Consider the example:

  1. in the first test case, players 2 and 3 with skills 7 and 9 advance to the finals; 
  2. in the second test case, players 2 and 4 with skills 5 and 9 advance to the finals. The player with skill 6 does not advance, but the player with skill 5 advances to the finals, so the tournament is not fair; 
  3. in the third test case, players 1 and 3 with skills 5 and 8 advance to the finals; 
  4. in the fourth test case, players 1 and 3 with skills 6 and 3 advance to the finals. The player with skill 5 does not advance, but the player with skill 3 advances to the finals, so the tournament is not fair. 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Solve {

	static int mod = 1000000000 + 7;
	static long INF = 1000_000_000_000_000L + 100;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();
		while (t-- > 0) {
			int a[] = new int[4];
			int s1 = sc.nextInt();
			int s2 = sc.nextInt();

			int s3 = sc.nextInt();
			int s4 = sc.nextInt();
			a[0] = s1;
			a[1] = s2;
			a[2] = s3;
			a[3] = s4;
			Arrays.sort(a);
			int x = Math.max(s1, s2);
			int y = Math.max(s3, s4);
			boolean valid = true;
			if (a[2] != x && a[2] != y)
				valid = false;

			if (a[3] != x && a[3] != y)
				valid = false;

			pw.println(valid ? "YES" : "NO");

		}

		pw.flush();

	}

	static public boolean[] sieve(int n) {
		boolean prime[] = new boolean[n + 1];
		for (int i = 0; i <= n; i++)
			prime[i] = true;

		for (int p = 2; p * p <= n; p++) {
			// If prime[p] is not changed, then it is a
			// prime
			if (prime[p] == true) {
				// Update all multiples of p
				for (int i = p * p; i <= n; i += p)
					prime[i] = false;
			}
		}
		return prime;

	}

	static boolean isPalindrome(String str) {

		// Pointers pointing to the beginning
		// and the end of the string
		int i = 0, j = str.length() - 1;

		// While there are characters to compare
		while (i < j) {

			// If there is a mismatch
			if (str.charAt(i) != str.charAt(j))
				return false;

			// Increment first pointer and
			// decrement the other
			i++;
			j--;
		}

		// Given string is a palindrome
		return true;
	}

	public static int primeFactors(int n) {
		int count = 0;
		// Print the number of 2s that divide n
		while (n % 2 == 0) {
			n /= 2;
		}

		if (n == 1)
			return 0;

		// n must be odd at this point. So we can
		// skip one element (Note i = i +2)
		for (int i = 3; i <= Math.sqrt(n); i += 2) {
			// While i divides n, print i and divide n
			while (n % i == 0) {
				n /= i;
				count++;
			}
		}

		if (n > 1)
			count++;

		return count;

	}

	static int gcd(int a, int b) {
		if (a == 0)
			return b;
		if (b == 0)
			return a;

		return gcd(b, a % b);

	}

	public static int[] swap(int data[], int left, int right) {

		// Swap the data
		int temp = data[left];
		data[left] = data[right];
		data[right] = temp;

		// Return the updated array
		return data;
	}

	static long nCrModp(int n, int r, int p) {
		if (r > n - r)
			r = n - r;

		// The array C is going to store last
		// row of pascal triangle at the end.
		// And last entry of last row is nCr
		int C[] = new int[r + 1];

		C[0] = 1; // Top row of Pascal Triangle

		// One by constructs remaining rows of Pascal
		// Triangle from top to bottom
		for (int i = 1; i <= n; i++) {

			// Fill entries of current row using previous
			// row values
			for (int j = Math.min(i, r); j > 0; j--)

				// nCj = (n-1)Cj + (n-1)C(j-1);
				C[j] = (C[j] + C[j - 1]) % p;
		}
		return C[r];
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

}

class Pair implements Comparable<Pair> {
	int tower;
	int value = 0;

	Pair(int x, int y) {
		tower = x;
		value = y;
	}

	public int compareTo(Pair o) {
		return this.value - o.value;
	}

}

class Scanner {
	BufferedReader br;
	StringTokenizer st;

	Scanner() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() throws IOException {
		while (st == null || !st.hasMoreElements())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(next());
	}

	int[] nextIntArray(int n) throws NumberFormatException, IOException {
		int a[] = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(next());
		return a;
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(next());
	}

	long[] nextLongArray(int n) throws NumberFormatException, IOException {
		long a[] = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = Long.parseLong(next());
		return a;
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(next());
	}
}