#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int p = 1e9 + 7;
inline int64_t fpow(int64_t n, int64_t k) {
  int64_t r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> d;
    int num = 0, sum = 0;
    for (int i = 0; i <= n - 1; i++) {
      int x;
      cin >> x;
      if (x != 0) {
        d.push_back(x);
        sum += x;
      } else
        num++;
    }
    int m = d.size();
    if (sum == 0)
      cout << "NO" << '\n';
    else {
      cout << "YES" << '\n';
      sort(d.begin(), d.end());
      bool kt = true;
      int tmp = 0;
      for (int i = 0; i <= m - 1; i++) {
        tmp += d[i];
        if (tmp == 0) {
          kt = false;
          break;
        }
      }
      if (!kt) reverse(d.begin(), d.end());
      for (auto it : d) cout << it << " ";
      for (int i = 1; i <= num; i++) cout << 0 << " ";
      cout << '\n';
    }
  }
}
