#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
inline long long ni() {
  long long x;
  cin >> x;
  return x;
}
template <class T>
inline T nt() {
  T x;
  cin >> x;
  return x;
}
inline void print() {}
template <typename T, typename... TAIL>
inline void print(const T &t, TAIL... tail) {
  cout << t;
  print(tail...);
}
inline void input() { return; }
template <typename T, typename... TAIL>
inline void input(T &t, TAIL &...tail) {
  cin >> t;
  input(tail...);
}
const long long N = 2e5 + 1;
const long long inf = 1e18 + 7;
const double PI = 3.14159265359;
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<pair<long long, long long> > v;
    for (long long i = 0; i < n; i++) {
      v.push_back({ni(), i});
    }
    sort((v).begin(), (v).end());
    vector<long long> ans(n, 1);
    for (long long i = 0; i < n / 2; i++) {
      if (v[i].first > 0) {
        ans[v[i].second] *= -1;
      }
    }
    for (long long i = n / 2; i < n; i++) {
      if (v[i].first < 0) {
        ans[v[i].second] *= -1;
      }
    }
    for (long long i = 0; i < n / 2; i++) {
      ans[v[i].second] *= abs(v[n - i - 1].first);
      ans[v[n - i - 1].second] *= abs(v[i].first);
    }
    for (long long i = 0; i < n; i++) cout << ans[i] << ' ';
    cout << '\n';
  }
  return 0;
}
