Programming Languages solution codechef
Chef is a software developer, so he has to switch between different languages sometimes. Each programming language has some features, which are represented by integers here.
Currently, Chef has to use a language with two given featuresand . He has two options — switching to a language with two features and , or to a language with two features and . All four features of these two languages are pairwise distinct.
Tell Chef whether he can use the first language, the second language or neither of these languages (if no single language has all the required features).
Input Format Programming Languages solution codechef
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains six space-separated integers .
For each test case, print a single line containing the integerif Chef should switch to the first language, or if Chef should switch to the second language, or if Chef cannot switch to either language.
Constraints Programming Languages solution codechef
- are distinct
- are pairwise distinct
Subtask #1 (100 points): original constraints
Sample Input 1 Programming Languages solution codechef
3 1 2 2 1 3 4 3 4 2 1 4 3 1 2 1 3 2 4
Sample Output 1
1 2 0
Explanation Programming Languages solution codechef
Example case 1: The first language has the required features — featuresand .
Example case 2: The second language has the required features — featuresand .
Example case 3: Neither language has both featuresand .