311338: CF1971C. Clock and Strings

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:3 Solved:0

Description

C. Clock and Stringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There is a clock labeled with the numbers $1$ through $12$ in clockwise order, as shown below.

In this example, $(a,b,c,d)=(2,9,10,6)$, and the strings intersect.

Alice and Bob have four distinct integers $a$, $b$, $c$, $d$ not more than $12$. Alice ties a red string connecting $a$ and $b$, and Bob ties a blue string connecting $c$ and $d$. Do the strings intersect? (The strings are straight line segments.)

Input

The first line contains a single integer $t$ ($1 \leq t \leq 5940$) — the number of test cases.

The only line of each test case contains four distinct integers $a$, $b$, $c$, $d$ ($1 \leq a, b, c, d \leq 12$).

Output

For each test case, output "YES" (without quotes) if the strings intersect, and "NO" (without quotes) otherwise.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).

ExampleInput
15
2 9 10 6
3 8 9 1
1 2 3 4
5 3 4 12
1 8 2 10
3 12 11 8
9 10 12 1
12 1 10 2
3 12 6 9
1 9 8 4
6 7 9 12
7 12 9 6
10 12 11 1
3 9 6 12
1 4 3 5
Output
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
Note

The first test case is pictured in the statement.

In the second test case, the strings do not intersect, as shown below.

Output

题目大意:
这个题目是关于一个标记有数字1到12的钟面,数字按顺时针排列。Alice和Bob各有四个不同的整数a, b, c, d(每个都不超过12),Alice用一根红绳连接a和b,Bob用一根蓝绳连接c和d。需要判断这两根绳子是否相交(假设绳子是直线段)。

输入数据格式:
第一行包含一个整数t(1 ≤ t ≤ 5940),表示测试用例的数量。
每个测试用例包含一行,有四个不同的整数a, b, c, d(1 ≤ a, b, c, d ≤ 12)。

输出数据格式:
对于每个测试用例,如果两根绳子相交,输出"YES"(不包含引号),否则输出"NO"(不包含引号)。
"YES"和"NO"的大小写不影响结果判断。题目大意: 这个题目是关于一个标记有数字1到12的钟面,数字按顺时针排列。Alice和Bob各有四个不同的整数a, b, c, d(每个都不超过12),Alice用一根红绳连接a和b,Bob用一根蓝绳连接c和d。需要判断这两根绳子是否相交(假设绳子是直线段)。 输入数据格式: 第一行包含一个整数t(1 ≤ t ≤ 5940),表示测试用例的数量。 每个测试用例包含一行,有四个不同的整数a, b, c, d(1 ≤ a, b, c, d ≤ 12)。 输出数据格式: 对于每个测试用例,如果两根绳子相交,输出"YES"(不包含引号),否则输出"NO"(不包含引号)。 "YES"和"NO"的大小写不影响结果判断。

加入题单

算法标签: