Abnormal 91's
Time Limit: 1 Second Memory Limit: 65536 KB
As we all know a common method of choosing a name for teams participating in programming contests in Iran, is to choose a combination of initials of team members. For instance Jafar, MohammadKazam and Bahman would name their team “JBM”. One of the first teams that ever used this method is PMP.
Abnormal 91’s, have come up with a fresh idea for naming their team. Instead of using the initials, they concatenate their complete names. As an example mohammadmehdi, amirardalan and seyyedmostafa would name their team:
Some of 91’s even go further and to make their team’s name more stylish, they reversed the name of the person in middle. Therefore, the name of the example team would be:
Note that order of team members in the naming are fixed, so names are unique for each team. Given the names of members of one team, as well as name of the team in first 91’s style, you have to find the team’s name in the second 91’s style.
Input
The first line contains an integer T (T ≤ 100), the number of tests. Each test consists of two lines. First line contains three strings, the names of team members in some random order. These strings are separated with a single space. The names of all the team members consist of only English lowercase letters and length of each name will not exceed 50 characters. Second line of each test contains a single string, a valid name of the team in the first 91’s style.
Output
For each test print team’s name in the second 91’s style in a single line. It is guaranteed that the answer is unique.
Sample Input
2 piloop mj poopi piloopipoopmj azhdar gholi gholam gholamradhzagholi
Sample Output
pilooppoopimj gholamazhdargholiSubmit
Source: AUT 2012