题目描述
Utkarsh is currently sitting for placements. He has applied to three companies named A, B, and C.
You know Utkarsh's order of preference among these 3 companies, given to you as characters first, second, and third respectively (where first is the company he prefers most).
You also know that Utkarsh has received offers from exactly two of these three companies, given you as characters x and y.
Utkarsh will always accept the offer from whichever company is highest on his preference list. Which company will he join?
------ Input Format ------
- The first line of 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 three different space-separated characters: first, second, and third, denoting Utkarsh's order of preference among the three companies.
- The second line of each test case contains two space-separated characters x and y, the companies from which Utkarsh has received offers.
------ Output Format ------
For each test case, print one line containing a single character, the company whose offer Utkarsh will accept.
The output is not case sensitive, so if the answer is A, both a and A will be accepted.
------ Constraints ------
$1 ≤ T ≤ 36$
- first, second and third are three different characters among $\{A, B, C\}$.
$x$ and $y$ are two different characters among $\{A, B, C\}$.
------ subtasks ------
Subtask #1 (100 points): Original constraints
----- Sample Input 1 ------
2
A B C
A B
B C A
A C
----- Sample Output 1 ------
A
C
----- explanation 1 ------
Test Case 1. Utkarsh has received offers from $A$ and $B$. Of these two, he prefers company $A$ (first preference) over $B$ (second preference). Therefore Utkarsh will accept the offer of company $A$.
Test Case 2. Utkarsh has received offers from $A$ and $C$, where company $C$ is his second preference and company $A$ is his third preference. Utkarsh will accept the offer of company $C$.
输入格式
见题面
输出格式
见题面