#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> pos, neg, zero;
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      if (x == 0)
        zero.push_back(x);
      else if (x > 0)
        pos.push_back(x);
      else if (x < 0)
        neg.push_back(x);
    }
    long long pos_sum = accumulate(pos.begin(), pos.end(), 0LL);
    long long neg_sum = -accumulate(neg.begin(), neg.end(), 0LL);
    if (pos_sum > neg_sum) {
      cout << "YES\n";
      for (long long x : pos) cout << x << " ";
      for (long long x : neg) cout << x << " ";
      for (long long x : zero) cout << x << " ";
      cout << "\n";
    } else if (neg_sum > pos_sum) {
      cout << "YES\n";
      for (long long x : neg) cout << x << " ";
      for (long long x : pos) cout << x << " ";
      for (long long x : zero) cout << x << " ";
      cout << "\n";
    } else {
      cout << "NO\n";
    }
  }
}
