#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return (a);
  else
    return (gcd(b, a % b));
}
int lcm(int a, int b) { return ((a * b) / gcd(a, b)); }
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int k = n;
    vector<int> a, b;
    while (k--) {
      int c;
      cin >> c;
      a.push_back(c);
    }
    for (int i = 0; i < n; i += 2) {
      int l = lcm(a[i], a[i + 1]);
      b.push_back(l / a[i]);
      b.push_back(-(l / a[i + 1]));
    }
    for (int i = 0; i < n; i++) {
      cout << b[i] << " ";
    }
    a.clear();
    b.clear();
    cout << endl;
  }
  return 0;
}
