Under construction

Still being built. Things may change

Kim Incheon's Grocery Store (Large)

Interview

Time limit5sMemory limit512 MB

Summary
Given 2N sorted tags that pair N sale prices with regular prices at 4/3 of each sale price, recover the N sale tags.
Level

Medium5 of 10

Topics
Greedy, Hash map, Sorting
Solved
No attempts yet

Problem

Kim Incheon, who owns a grocery store in Incheon, is preparing a store wide sale. To keep the arithmetic simple he decided to sell every item at a 25% discount, so the sale price of an item is exactly 75% of its regular price. Every regular price in the store is an integer multiple of 4, so every sale price is an integer too.

While setting up the sale he printed a sale price tag for every item, and he also printed a regular price tag for every item to put back after the sale ends.

A customer came in, and while he was away the printer sorted all of the tags by price in ascending order without separating the two kinds and produced a single stack. The sale tag and the regular tag of every item are somewhere in that stack. The two kinds of tags look the same, and Kim Incheon does not remember the price of every item.

For example, if three items have regular prices 20, 80 and 100, their sale prices are 15, 60 and 75, and the printed stack is sorted as 15, 20, 60, 75, 80, 100.

Given the 2N2N prices in the stack, find the NN prices that are written on the sale tags.

Input

The first line contains the number of test cases TT. Then TT test cases follow, and each test case consists of two lines. The first line contains the number of items in the store, NN. The second line contains the 2N2N integers P1,P2,…,P2NP_1, P_2, \dots, P_{2N} that the printer produced in ascending order of price.

  • 1≤T≤1001 \le T \le 100
  • 1≤N≤1001 \le N \le 100
  • 1≤Pi≤1091 \le P_i \le 10^9 for every ii
  • Pi≤Pi+1P_i \le P_{i+1} for every ii
  • The answer is guaranteed to be unique.

Output

For each test case print one line in the format Case #x: y, where xx is the test case number starting from 1 and yy is the NN integers written on the sale tags, sorted in ascending order and separated by single spaces.

Hint

Several items can share the same price, and the sale price of one item can equal the regular price of another item.

Examples1

  1. Example 1

    Input
    2
    3
    15 20 60 75 80 100
    4
    9 9 12 12 12 15 16 20
    
    Expected output
    Case #1: 15 60 75
    Case #2: 9 9 12 15