← Home
package main

import (
	"bufio"
	"fmt"
	"os"
)

func between(x, a, b int) bool {
	if a < b {
		return a < x && x < b
	}
	return x > a || x < b
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var a, b, c, d int
		fmt.Fscan(in, &a, &b, &c, &d)
		if between(c, a, b) != between(d, a, b) {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}