#include <bits/stdc++.h>
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n], brr[n];
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      if (i % 2 != 0) {
        int l = lcm(abs(arr[i - 1]), abs(arr[i]));
        brr[i - 1] = (l / abs(arr[i - 1]));
        brr[i] = (l / abs(arr[i]));
        if (brr[i - 1] * arr[i - 1] + brr[i] * arr[i] != 0) {
          brr[i - 1] *= -1;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << brr[i] << " ";
    }
    cout << endl;
  }
}
