400914: GYM100283 H The Job Interview

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. The Job Interviewtime limit per test15.0 smemory limit per test256 megabytesinputdice.inoutputstandard output

Bakkar has just finished his military service. And as we know that he had a job offer from the same company he interned at when he was at college. But because of the delay caused by the military service the company wants to make sure that Bakkar is still a good candidate for the position. They know that Bakkar is very talented and a hard working person. That's why they didn’t cancel the job offer and delayed his start date a year later. But they decided to conduct one final technical interview to ensure his readiness.

The interview had one problem solving question. The interviewer introduced himself and had a little conversation with Bakkar to update him with the company's state and to break any interview tension that Bakkar may have. Afterwards the interviewer introduced a problem to Bakkar on a whiteboard. The problem stated that a statistician was building a perfect random number generator machine using two 6-sided die (the plural of dice). He throws the 2 dice and the output is the sum of the top faces of each dice. The statistician uses any die as long as it has 6 distinct positive numbers on its faces.

The main problem lies that the statistician forgot the numbers on the faces of both die. But he can still know all the possible unique sums the machine can generate. Bakkar is now required to use this information to find the original values on the faces of both die. He will be given all the possible unique sums the machine can generate, and his task is to find any configuration for two die that will produce such sums if they are used by the machine.

Bakkar solved the problem and the interviewer is going to test it using some test cases he already generated. Do you think Bakkar will get the job and be able to marry Maymona?!! Let's see ;).

Input

The program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1  ≤  T  ≤  100). Followed by T test cases, each test case starts with a line containing a single integer N, the number of possible sums (1  ≤  N  ≤  36). The next line contains N distinct positive integers, sorted in ascending order. Each integer S_i represents one possible sum (2  ≤  S_i  ≤  2000).

Output

For each test case print a line containing "Case n:" (without the quotes) where n is the test case number (starting from 1), followed by 2 lines. Each line contains the 6 values on the faces of one dice in any order. It is safe to assume that a solution always exists. If there are multiple solutions, print any.

ExamplesInput
1
11
2 3 4 5 6 7 8 9 10 11 12
Output
Case 1:
1 2 3 4 5 6
1 2 3 4 5 6

加入题单

上一题 下一题 算法标签: