#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(20) << fixed;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    vector<long long> b, c;
    long long s = 0, z = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] > 0) {
        b.push_back(a[i]);
        s += a[i];
      } else if (a[i] == 0)
        z++;
      else
        c.push_back(a[i]);
    }
    long long f = 0;
    for (long long i = 0; i < c.size(); i++) {
      if (s + c[i] != 0) {
        s += c[i];
        b.push_back(c[i]);
      } else {
        f = 1;
        b.push_back(c[i]);
        s += c[i];
      }
    }
    if (f == 1) reverse(b.begin(), b.end());
    for (long long i = 0; i < z; i++) b.push_back(0);
    if (s == 0)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (long long i = 0; i < n; i++) cout << b[i] << " ";
      cout << endl;
    }
  }
  return 0;
}
