Limits 1s, 512 MB

There exists a N×NN \times N board with each cell containing an integer.The rows are numbered 1 to NN from top to bottom and the columns are numbered 1 to NN from left to right. Integers in the same row is distinct, sorted in strictly increasing order and the same is true for each column. (Note that there may be same integer in the board multiple times, but they are always in different row and column).

You really want to know all the integers in the board in each position. But we don't always get what we want. Do we? But this time you are very lucky. There are NN rows and NN columns, right? You know 2×N12 \times N - 1 sequence of NN integers (each sequence representing either a row or a column of the original board). Can you figure out the sequence that you don't know?

Input

First line contains an integer, TT (1T501 ≤ T ≤ 50), number of test cases you have to solve. Then for each test case, first line contains an integer NN (1N501 ≤ N ≤ 50). The next 2×N12 \times N - 1 lines represent the sequence, each line containing exactly NN integers.

1Elements of the Board25001 ≤ \text{Elements of the Board} ≤ 2500.

Output

For each test case, output one line containing “Case t: x” (w/o quotes), where t is the test case number (starting from 1) and xx is a sequence of NN integers in strictly increasing order, representing the missing sequence. If there is multiple valid sequence, print any of them.

Sample

InputOutput
1
3
1 2 3
2 3 5
3 5 6
2 3 4
1 2 3
Case 1: 3 4 6

One possible table is the following:

1 2 3
2 3 5
3 4 6

Submit

Login to submit.

Statistics

83% Solution Ratio
hamza05Earliest, Nov '19
nusuBotFastest, 0.0s
noshin_faizaLightest, 0 B
hamza05Shortest, 732B
Toph uses cookies. By continuing you agree to our Cookie Policy.