{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"$N$ line segments (numbered $1$ through $N$) are placed on the $x$-axis. For each valid $i$, the $i$-th segment starts at $x \u003d L_i$ and ends at $x \u003d R_i$.\r\n\r\nAt the time $t \u003d 0$, all segments start moving; for each valid $i$, the $i$-th segment starts moving with speed $V_i$. You need to assign a direction - left or right - to the movement of each segment, i.e. choose a sign for each $V_i$ (not necessarily the same for all segments). The resulting movement must satisfy the following condition: at the time $t \u003d 10^{10000}$, there are no two segments that touch or intersect.\r\n\r\nDecide if it is possible to assign directions to the segments in such a way that the above condition is satisfied.\r\n\r\n### Input\r\n- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\r\n- The first line of each test case contains a single integer $N$.\r\n- $N$ lines follow. For each $i$ ($1 \\le i \\le N$), the $i$-th of these lines contains three space-separated integers $L_i$, $R_i$ and $V_i$.\r\n\r\n### Output\r\nFor each test case, print a single line containing the string `\"YES\"` if it is possible to assign the directions in a valid way or `\"NO\"` if it is impossible.\r\n\r\n### Constraints\r\n- $1 \\le T \\le 100$\r\n- $1 \\le N \\le 1,000$\r\n- $1 \\le L_i \\lt R_i \\le 10^9$ for each valid $i$\r\n- $1 \\le V_i \\le 10^9$ for each valid $i$\r\n- the sum of $N$ over all test cases does not exceed $2,000$\r\n\r\n### Example Input\r\n```\r\n2\r\n4\r\n5 7 2\r\n4 6 1\r\n1 5 2\r\n6 8 1\r\n4\r\n1 2 1\r\n1 2 1\r\n1 2 1\r\n1 2 1\r\n```\r\n\r\n### Example Output\r\n```\r\nYES\r\nNO\r\n```\r\n\r\n### Explanation\r\n**Example case 1:** We can assign the direction *left* to the $1$-st and $2$-nd segment and *right* to the $3$-rd and $4$-th segment.\r\n\r\n**Example case 2:** There is no valid way to assign directions to segments.\r\n"}}]}