#Lutece0672. Hexagon Perplexagon

Hexagon Perplexagon

Migrated from Lutece 672 Hexagon Perplexagon

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 well known puzzle consists of 77 hexagonal pieces, each with the numbers 11 through 66 printed on the sides. Each piece has a different arrangement of the numbers on its sides, and the object is to place the 77 pieces in the arrangement shown below such that the numbers on each shared edge of the arrangement are identical. Figure (a) is an example of one solution:

title

Input

The first line of the input file will contain a single integer indicating the number of test cases. Each case will consist of a single line containing 4242 integers. The first 66 represent the values on piece 00 listed in clockwise order; the second 66 represent the values on piece 11, and so on.

Output

For each test case, output the case number (using the format shown below) followed by either the phrase

No solution or by a solution specification. A solution specification lists the piece numbers in the order shown in the Position Notation of Figure (b). Thus if piece 33 is in the center, a 33 is printed first; if piece 00 is at the top, 00 is printed second, and so on. Each test case is guaranteed to have at most one solution.

Samples

输入数据 1

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

输出数据 1

Case 1: 3 0 5 6 1 4 2
Case 2: No solution

Note

Rotating any solution also gives another trivially identical solution. To avoid this redundancy, we will only deal with solutions which have a 11 on the uppermost edge of the central piece, as in the example.

Resources

2012 East Central Regional Contest