#include <bits/stdc++.h>
using namespace std;
int NOD(int a, int b) {
  while (a > 0 && b > 0)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    vector<int> pechati(n);
    for (int k = 0; k < n; ++k) {
      int temp;
      cin >> temp;
      pechati[k] = temp;
    }
    for (int k = 0; k < n; k += 2) {
      int nok = pechati[k] * pechati[k + 1] /
                NOD(abs(pechati[k]), abs(pechati[k + 1]));
      cout << -(nok / pechati[k]) << " ";
      cout << nok / pechati[k + 1] << " ";
    }
    cout << endl;
  }
}
