IPSC Logo

Internet Problem Solving Contest

IPSC 2010

Problem A – Antisort

Usually, in programming contests the problem statement tells you what to do. We find that boring.

In this task we do the opposite. We will tell you something you must not do:

You must not sort the given sequence.

Problem specification

Given is a sequence S of distinct integers. Rearrange the sequence in any way. The only condition is that the resulting sequence must not be sorted – neither in ascending nor in descending order.

Input specification

The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.

Each test case consists of two lines. The first line contains a number N (between 3 and 1000, inclusive) giving the length of the sequence. The second line contains N space separated numbers that form the sequence. No two of these N numbers are equal, and all of these numbers fit into a 32-bit signed integer variable.

Output specification

The output format is the same as the input format, with one exception: The whitespaces may be arbitrary. Just make sure that every two tokens in the output are separated by at least one whitespace.

Each sequence in the output must contain the same numbers as the corresponding input sequence, and they must not be in sorted order.

Example

input
2

5
1 2 3 4 5

8
3 1 4 47 5 9 2 6
output
2

5
5 1 4 3 2

8
3 1 4 47
5 9 2 6