#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void solve() {
  int n;
  cin >> n;
  vector<long long> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  vector<int> ans(n, 1);
  for (int i = 0; i < n; i += 2) {
    int v = lcm(abs(d[i]), abs(d[i + 1]));
    ans[i] *= v / abs(d[i]);
    ans[i + 1] *= v / abs(d[i + 1]);
    if ((d[i] < 0 && d[i + 1] < 0) || (d[i] > 0 && d[i + 1] > 0)) ans[i] *= -1;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
