Under construction

Still being built. Things may change

Multiples of N (2)

Time limit1sMemory limit512 MB

Summary
Given 2N-1 integers, each at least 0 and less than N, pick N of them whose sum is divisible by N, or print -1 if none exists.
Level

Medium7 of 10

Topics
Number theory, Math, Array, Divide and conquer
Solved
No attempts yet

Problem

You are given 2N−12N-1 numbers. Find NN of them whose sum is divisible by NN.

Input

The first line contains NN (1≤N≤5 0001 \le N \le 5\ 000).

The second line contains 2N−12N-1 numbers, each at least 00 and less than NN, separated by spaces.

Output

Print NN numbers that satisfy the condition, separated by spaces, on the first line.

If several answers exist, printing any one of them is accepted. The order of the printed numbers does not matter.

If no set of NN numbers satisfies the condition, print -1.

Examples1

  1. Example 1

    Input
    4
    1 2 3 0 1 2 3
    
    Expected output
    1 1 3 3