P18437 [CodeChef] WATCHFB
提高-
题目描述

Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef and his son Chefu want to watch a match of their favourite football team playing against another team, which will take place today.

Unfortunately, Chef is busy in the kitchen preparing lunch, so he cannot watch the match. Therefore, every now and then, Chef asks Chefu about the current scores of the teams and Chefu tells him the score. However, Chefu sometimes does not specify the teams along with the score — for example, he could say "the score is 3 to 6", and there is no way to know just from this statement if it was their favourite team or the other team that scored 6 goals; in different statements, the order of teams may also be different. Other times, Chefu specifies which team scored how many goals.

Chef asks for the score and receives a reply $N$ times. There are two types of replies:
1 A B: their favourite team scored $A$ goals and the other team scored $B$ goals
2 A B: one team scored $A$ goals and the other scored $B$ goals

Chef is asking you to help him determine the score of his favourite team after each of Chefu's replies. After each reply, based on the current reply and all previous information (but without any following replies), tell him whether it is possible to certainly determine the number of goals scored by his favourite team.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The following $N$ lines describe Chefu's replies in the format described above.

------ Output ------
For each of Chefu's replies, print a single line containing the string "YES" if it is possible to determine the score of Chef's favourite team after this reply or "NO" if it is impossible.

------ Constraints ------
$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10^{4}$
$0 ≤ A, B ≤ 10^{9}$
the sum of $N$ over all test cases does not exceed $10^{5}$
there is at least one valid sequence of scored goals consistent with all replies

------ Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------
1

6

2 0 1

1 3 1

2 2 4

2 5 6

2 8 8

2 9 10
----- Sample Output 1 ------
NO

YES

YES

NO

YES

NO
----- explanation 1 ------
Example case 1:
- Reply 1: Chef cannot know who scored the first goal.
- Reply 2: Chefu told Chef that their favourite team has scored $3$ goals so far.
- Reply 3: Chef can conclude that his favourite team has scored $4$ goals, since it already scored $3$ goals earlier.
- Reply 4: the favourite team could have scored $5$ or $6$ goals, but there is no way to know which option is correct.
- Reply 5: since there is a tie, Chef knows that his favourite team has scored $8$ goals.
- Reply 6: again, Chef cannot know if his favourite team has scored $9$ or $10$ goals.

输入格式

见题面

输出格式

见题面

样例输入
1 6 2 0 1 1 3 1 2 2 4 2 5 6 2 8 8 2 9 10
样例输出
NO YES YES NO YES NO