#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    for (int i = n - 1; i >= 0; i--) {
      if (i % 2 == 0) {
        arr[i] = (int)(pow(-1, i) + 0.5) * arr[i];
        cout << arr[i] << " ";
      } else {
        arr[i] = (int)(pow(-1, i) - 0.5) * arr[i];
        cout << arr[i] << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
