#Lutece0121. Guess the Dice
Guess the Dice
Migrated from Lutece 121 Guess the Dice
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
A regular dice is a cube with numbers ( to ) on its faces. When you look at a corner of a dice you can see faces and of course the numbers on them. Now you're given views from corners of a dice, and your task is to tell what number is on the opposite side of a given number.
Input
One integer on the first line indicates the number of cases.
Then followed by cases, every case contains lines. Each line contains integers , , describing the view from one corner of the dice (look at the picture for details).
It's not guaranteed that the order of the views is given in the same way as the sample input.
Output
For each case, print integers separated by space on a line. The -th number indicates the number on the opposite side of .
Samples
1
1 2 3
1 3 4
1 4 5
1 5 2
6 3 2
6 4 3
6 5 4
6 2 5
6 4 5 2 3 1
Resources
The 8th UESTC Programming Contest Final