Well, I was planning to set a problem for beginners, that is: given n distinct integers greater than 1, find the all-pair multiplications. For example, n = 4 and the integers are {2, 5, 8, 6} then the result would be {10, 12, 16, 30, 68, 40}. As the results can be printed in any order so, I wrote a special judge for this problem.
But it was a long time ago. Now, I want to complete this problem and found out that I only have the output file of the problem. The input file is missing. All you have to do is to generate the input file from the given output file.
Input
Input starts with an integer T (≤ 20), denoting the number of test cases.
Each case starts with an integer n (3 ≤ n ≤ 200). The next line contains n*(n-1)/2 integers showing the all-pair multiplications. You can assume that for a given integer x, 6 ≤ x < 263.
Output
For each case, print the case number and the input integers in ascending order, separated by a single space. If there are multiple solutions, print the one with the smallest first integer (after sorting), in case of tie, the one with the smallest second integer and so on. You can assume that there will always be at least one solution.
Sample
Sample Input | Sample Output |
---|---|
2 4 10 12 16 30 48 40 3 10 20 8 | Case 1: 2 5 6 8 Case 2: 2 4 5 |
Notes
Dataset is huge, use faster I/O methods.