#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int NOD(int a, int b) {
  if (a < b) swap(a, b);
  if (b == 0)
    return a;
  else
    return NOD(b, a % b);
}
int lcm(int a, int b) { return a / NOD(a, b) * b; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t;
  cin >> t;
  for (ll i = 0; i < t; i++) {
    int n;
    cin >> n;
    for (ll j = 0; j < n / 2; j++) {
      int a, b;
      cin >> a >> b;
      if (a > 0 and b > 0) {
        a = abs(a);
        b = abs(b);
        int k = lcm(a, b);
        cout << -(k / a) << ' ' << (k / b) << ' ';
      } else {
        if (a < 0 and b > 0 || a > 0 and b < 0) {
          a = abs(a);
          b = abs(b);
          int k = lcm(abs(a), abs(b));
          cout << (k / a) << ' ' << (k / b) << ' ';
        }
        if (a < 0 and b < 0) {
          a = abs(a);
          b = abs(b);
          int k = lcm(abs(a), abs(b));
          cout << -(k / a) << ' ' << (k / b) << ' ';
        }
      }
    }
    cout << endl;
  }
}
