#include <bits/stdc++.h>
using namespace std;
int a[55], b[55], T;
int main() {
  scanf("%d", &T);
  while (T--) {
    int n, n1 = 0, n2 = 0, x, s = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &x);
      if (x > 0) a[++n1] = x;
      if (x < 0) b[++n2] = x;
      s += x;
    }
    if (n1 + n2 == 0 || s == 0) {
      cout << "NO" << endl;
      continue;
    }
    if (s < 0) {
      cout << "YES" << endl;
      for (int i = 1; i <= n2; ++i) cout << b[i] << " ";
      for (int i = 1; i <= n1; ++i) cout << a[i] << " ";
      for (int i = 1; i <= n - n1 - n2; ++i) cout << "0 ";
    }
    if (s > 0) {
      cout << "YES" << endl;
      for (int i = 1; i <= n1; ++i) cout << a[i] << " ";
      for (int i = 1; i <= n2; ++i) cout << b[i] << " ";
      for (int i = 1; i <= n - n1 - n2; ++i) cout << "0 ";
    }
  }
}
