Codeforces Round 1033 (Div. 2) and CodeNite 2025
A
Square of Rectangles
Codeforces
800
原题
←B →
翻译中…

Aryan is an ardent lover of squares but a hater of rectangles (Yes, he knows all squares are rectangles). But Harshith likes to mess with Aryan. Harshith gives Aryan three rectangles of sizes $l_1\times b_1$, $l_2\times b_2$, and $l_3\times b_3$ such that $l_3\leq l_2\leq l_1$ and $b_3\leq b_2\leq b_1$. Aryan, in order to defeat Harshith, decides to arrange these three rectangles to form a square such that no two rectangles overlap and the rectangles are aligned along edges. Rotating rectangles is not allowed. Help Aryan determine if he can defeat Harshith.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). The description of the test cases follows.

翻译中…

Each test case contains a single line with $6$ space-separated integers $l_1, b_1, l_2, b_2, l_3$, and $b_3$ ($1 \leq l_3\le l_2\le l_1\le 100$, $1\le b_3\le b_2\le b_1 \leq 100$) — the dimensions of the three rectangles.

翻译中…

Output

翻译中…

For each testcase, print "YES" if the rectangles can be arranged to form a square; otherwise, "NO".

翻译中…

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

翻译中…

Note

翻译中…

In the second test case, the three rectangles $5\times 3$, $5\times 1$, and $5\times 1$ can be arranged as follows to form a square.

翻译中…

image

翻译中…

In the fourth test case, it can be proven that the rectangles can't be arranged to form a square with the given constraints.

翻译中…

样例

Input #1
5
100 100 10 10 1 1
5 3 5 1 5 1
2 3 1 2 1 1
8 5 3 5 3 3
3 3 3 3 2 1
Output #1
NO
YES
YES
NO
NO
InputCopy OutputCopy
题目信息
题号
2120A
时间限制
1 s
内存限制
256 MB
标签
计算几何
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。