Welcome to ZOJ
Select Problem
ZOJ Problem Set - 1630

Time Limit: 2 Seconds      Memory Limit: 65536 KB

One day, WashingBone and gali play a game. WashingBone shoot dice for several times, and then, gali had to guess the points number of every face of the die. Every time gali can only see three face, front, right and top, of the die.

Your task is to help gali to guess the points number of six faces of the die.


There are several test cases. In every test case:

A line consist a interger number n > 0, represent the times of WashingBone shoot dice.

In next n lines, every line consist three initerger number 1 <= a, b, c <= 6, represent the front, right and top of the die.


If the there is no dice can be shoot the same as input, output a "T_T", else if there are several dice can be shoot the same as input, output a "=.-", else output the front, back, right, left, bottom and top face of the die.

Because the die can be rolled, so should output the minimum sequence of the six faces, see the sample output.

Sample Input

2 6 1
5 6 2
5 6 1
2 6 4
4 2 6
1 4 3
1 2 3
4 5 6

Sample Output

1 6 2 3 5 4

Author: CHEN, Gaoli
Source: ZOJ Monthly, June 2003
Submit    Status