#C7808. Symmetric Sequence Creation

    ID: 51720 Type: Default 1000ms 256MiB

Symmetric Sequence Creation

Symmetric Sequence Creation

Given an integer \( n \) and a sequence of \( n \) integers, rearrange the elements to form a symmetric sequence (i.e., a palindrome). The sequence is symmetric if it reads the same backward as forward. If it is impossible to rearrange the elements to form a palindrome, output IMPOSSIBLE.

Input/Output Guidelines: You must strictly follow the input and output format. All input is provided via stdin and all output should be written to stdout.

Hint: A necessary condition is that at most one distinct element appears an odd number of times. If more than one element appears an odd number of times, a symmetric arrangement is not possible.

inputFormat

The first line contains a single integer \( n \), representing the number of elements in the sequence.

The second line contains \( n \) space-separated integers denoting the elements of the sequence.

outputFormat

If it is possible to rearrange the sequence into a symmetric (palindromic) sequence, output the rearranged sequence as space-separated integers in one line. Otherwise, output IMPOSSIBLE.

## sample
5
1 2 3 2 1
1 2 3 2 1