#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> m, b, z;
  int sum = 0;
  int sumb = 0, summ = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    sum += a;
    if (a == 0) {
      z.push_back(a);
    } else if (a < 0) {
      m.push_back(a);
      summ += -a;
    } else {
      b.push_back(a);
      sumb += a;
    }
  }
  if (sum == 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    if (sumb > summ) {
      for (auto it : b) {
        cout << it << ' ';
      }
      for (auto it : z) {
        cout << it << ' ';
      }
      for (auto it : m) {
        cout << it << ' ';
      }
    } else {
      for (auto it : m) {
        cout << it << ' ';
      }
      for (auto it : z) {
        cout << it << ' ';
      }
      for (auto it : b) {
        cout << it << ' ';
      }
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cout << fixed << setprecision(15);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
