#include <bits/stdc++.h>
using ::std::cin;
using ::std::cout;
const int MAX = 100;
int a[MAX];
bool b[MAX];
bool c[MAX];
int main(int argc, const char* argv[]) {
  int t;
  cin >> t;
  for (int index = 0; index < MAX; index++) {
    b[index] = false;
    c[index] = false;
  }
  for (int index = 2; index < MAX; index++) {
    for (int j = 2; j < index; j++) {
      bool isPrime = true;
      if (index % j == 0) {
        isPrime = false;
        break;
      }
      b[index] = isPrime;
    }
  }
  while (t--) {
    int n;
    cin >> n;
    for (int index = 0; index < n; index++) {
      cin >> a[index];
    }
    if (n % 2 == 0) {
      int flag = -1;
      for (int index = n - 1; index >= 0; index--) {
        flag = flag * -1;
        int finalFlag = flag;
        if (a[index] < 0) {
          finalFlag *= -1;
        }
        if (index != n - 1) {
          cout << " ";
        }
        cout << a[index] * flag;
      }
    } else {
      int minPrime = 1;
      for (int index = 0; index < 3; index++) {
        int count = a[index];
        while (count > 1) {
          for (int j = 0; j < MAX; j++) {
            if (b[j] && count % j == 0) {
              count /= j;
              if (!c[j]) {
                minPrime *= j;
                c[j] = true;
              }
            }
          }
        }
      }
      int max = 0;
      int min = 0;
      int middle = 0;
      for (int index = 0; index < 3; index++) {
        if (a[index] < a[min]) {
          min = index;
        }
        if (a[index] > a[max]) {
          max = index;
        }
      }
      for (int index = 0; index < 3; index++) {
        if (index != min && index != max) {
          middle = index;
          break;
        }
      }
      if (max == min) {
        if (a[0] < 0) {
          cout << -1;
        } else {
          cout << 1;
        }
        if (a[1] < 0) {
          cout << " " << 1;
        } else {
          cout << " " << -1;
        }
        if (a[2] < 0) {
          cout << " " << -1;
        } else {
          cout << " " << 1;
        }
      } else {
        for (int index = 0; index < 3; index++) {
          if (index != 0) {
            cout << " ";
          }
          if (index == min) {
            if (a[index] < 0) {
              cout << -1 * a[middle];
            } else {
              cout << 1 * a[middle];
            }
          }
          if (index == middle) {
            if (a[index] < 0) {
              cout << -1 * (a[max] - a[min]);
            } else {
              cout << 1 * (a[max] - a[min]);
            }
          }
          if (index == max) {
            if (a[index] < 0) {
              cout << 1 * a[middle];
            } else {
              cout << -1 * a[middle];
            }
          }
        }
      }
      int flag = -1;
      for (int index = n - 1; index >= 3; index--) {
        flag = flag * -1;
        int finalFlag = flag;
        if (a[index] < 0) {
          finalFlag *= -1;
        }
        cout << " " << a[index] * finalFlag;
      }
    }
    cout << std::endl;
  }
  return 0;
}
