Perfect Memory

No attempts yetTime limit2sMemory limit128 MB

Problem

Hektor and Wiktor have a new and fascinating hobby: memorizing long sequences of integers. Each of them specializes in a particular kind of sequence. Hektor likes palindromes best, that is, sequences whose values at mirror positions are equal (the first matches the last, the second matches the second to last, and so on). Wiktor is an expert on antipalindromes, that is, sequences whose values at mirror positions are opposite (they sum to zero).

Lately the boys started wondering what becomes possible when they combine their skills. If they could split any sequence of integers into the sum of a palindrome and an antipalindrome, each of them could memorize his favorite kind of sequence, and together they could easily reconstruct the original.

For a given sequence SS of integers with even length NN, compute two sequences PP and AA, each of length NN, such that PP is a palindrome, AA is an antipalindrome, and adding the elements of PP and AA at corresponding positions yields the sequence SS.

Input

The first line contains a natural number ZZ (1Z101 \le Z \le 10), the number of test sets. The sets are then described one after another.

The first line of each set contains one nonzero even natural number NN (1N10000001 \le N \le 1000000), the length of the sequence SS.

The second line of each set contains NN integers sis_i (1000000si1000000-1000000 \le s_i \le 1000000), the consecutive elements of the sequence SS, separated by spaces.

Output

For each set:

  • If the given sequence SS can be split into the sum of the sequences PP and AA described above, print the sequence PP on the first line (with elements separated by single spaces) and the sequence AA on the second line.
  • Otherwise print the word NIE on a single line.