#K2261. Time Interval Overlap Checker

    ID: 24698 Type: Default 1000ms 256MiB

Time Interval Overlap Checker

Time Interval Overlap Checker

You are given two time intervals, represented as \([start1, end1)\) and \([start2, end2)\). The intervals are said to overlap if and only if $$start1 < end2 \quad \text{and} \quad start2 < end1.$$

Your task is to process several queries, with each query containing the definitions of two intervals. For each query, determine if the intervals overlap. Print "YES" if they do, otherwise print "NO".

inputFormat

The input is taken from standard input (stdin). The first line contains a single integer Q, representing the number of queries. Each of the following Q lines contains 4 space-separated integers: start1, end1, start2, end2.

outputFormat

For each query, output a single line to standard output (stdout) containing "YES" if the intervals overlap, or "NO" otherwise.## sample

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

NO YES

</p>