CF1413A.Finding Sasuke

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Finding Sasuke

Naruto has sneaked into the Orochimaru's lair and is now looking for Sasuke. There are TT rooms there. Every room has a door into it, each door can be described by the number nn of seals on it and their integer energies a1a_1, a2a_2, ..., ana_n. All energies aia_i are nonzero and do not exceed 100100 by absolute value. Also, nn is even.

In order to open a door, Naruto must find such nn seals with integer energies b1b_1, b2b_2, ..., bnb_n that the following equality holds: $a_{1} \cdot b_{1} + a_{2} \cdot b_{2} + ... + a_{n} \cdot b_{n} = 0$. All bib_i must be nonzero as well as aia_i are, and also must not exceed 100100 by absolute value. Please find required seals for every room there.

Input

The first line contains the only integer TT (1T10001 \leq T \leq 1000) standing for the number of rooms in the Orochimaru's lair. The other lines contain descriptions of the doors.

Each description starts with the line containing the only even integer nn (2n1002 \leq n \leq 100) denoting the number of seals.

The following line contains the space separated sequence of nonzero integers a1a_1, a2a_2, ..., ana_n (ai100|a_{i}| \leq 100, ai0a_{i} \neq 0) denoting the energies of seals.

Output

For each door print a space separated sequence of nonzero integers b1b_1, b2b_2, ..., bnb_n (bi100|b_{i}| \leq 100, bi0b_{i} \neq 0) denoting the seals that can open the door. If there are multiple valid answers, print any. It can be proven that at least one answer always exists.

Note

For the first door Naruto can use energies [100,1][-100, 1]. The required equality does indeed hold: 1(100)+1001=01 \cdot (-100) + 100 \cdot 1 = 0.

For the second door Naruto can use, for example, energies [1,1,1,1][1, 1, 1, -1]. The required equality also holds: $1 \cdot 1 + 2 \cdot 1 + 3 \cdot 1 + 6 \cdot (-1) = 0$.

Samples

2
2
1 100
4
1 2 3 6
-100 1
1 1 1 -1

在线编程 IDE

建议全屏模式获得最佳体验