#P9685. 三色
三色
Background
My heart is still beating.
Problem Description
You are given triples . There are queries. In each query, you are given a set . Determine whether there exists a real triple such that: for all satisfying , the set formed by their is exactly .
Input Format
The first line contains an integer , which represents the number of test cases.
For each test case, the first line contains three numbers , where .
The next lines each contain three integers .
The next lines describe the queries. The -th line contains integers , representing the elements of in the -th query. It is guaranteed that the elements are distinct.
Output Format
For each test case, output a string of length in one line. For the -th query, if the answer is “exists”, then is ; otherwise, is .
3
5 2 1
3 0 1
-2 2 2
1 -3 3
-2 -1 4
0 0 5
2
5
5 4 2
3 0 1
-2 2 2
1 -3 3
-2 -1 4
0 0 5
2 3
2 4
5 1
3 5
5 6 3
3 0 1
-2 2 2
1 -3 3
-2 -1 4
0 0 5
3 5 4
2 5 3
4 2 1
2 4 3
3 1 2
3 1 4
10
0110
100101
Hint
Constraints
For all testdata, , , , , .
For any , it is guaranteed that , and there do not exist and three different indices such that .
Subtasks
| # | Special Property | Points |
|---|---|---|
| 0 | Sample | 0 |
| 1 | 2 | |
| 2 | 11 | |
| 3 | 23 | |
| 4 | 29 | |
| 5 | 35 |
Translated by ChatGPT 5