#include <bits/stdc++.h>
using namespace std;
istream& operator>>(istream& in, vector<int>& A) {
  int n;
  in >> n;
  A.resize(n);
  for (int i = 0; i < n; ++i) in >> A[i];
  return in;
}
int NOD(int a, int b) { return b ? NOD(b, a % b) : a; }
int NOK(int a, int b) { return a * b / NOD(a, b); }
void show_answer(const vector<int>& A, int L, int R) {
  int a1 = 1, a2 = 1, nok;
  if (A[L] < 0) a1 = -1;
  if (A[R] > 0) a2 = -1;
  nok = NOK(abs(A[L]), abs(A[R]));
  cout << a1 * nok / abs(A[L]) << ' ';
  if (R - L > 1) show_answer(A, L + 1, R - 1);
  cout << a2 * nok / abs(A[R]) << ' ';
}
int main() {
  vector<int> A;
  int t;
  cin >> t;
  while (t > 0) {
    cin >> A;
    show_answer(A, 0, A.size() - 1);
    cout << '\n';
    --t;
  }
  return 0;
}
