#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 105;
long long gcd(long long a, long long b) { return b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long Pow(long long a, long long n, long long mod) {
  long long res = 1 % mod;
  a %= mod;
  while (n) {
    if (n & 1) res = res * a % mod;
    n >>= 1;
    a = a * a % mod;
  }
  return res;
}
vector<int> a, b;
int num[maxn], c[maxn];
bool cmp(int a, int b) { return a > b; }
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    a.clear();
    b.clear();
    int zheng = 0, fu = 0, zero = 0, sum = 0;
    for (int i = (0); i < (n); ++i) {
      scanf("%d", &num[i]);
      if (num[i] > 0)
        ++zheng, a.push_back(num[i]);
      else if (num[i] < 0)
        ++fu, b.push_back(num[i]);
      else
        ++zero;
      sum += num[i];
    }
    if (zheng == n || fu == n) {
      printf("YES\n");
      for (int i = (0); i < (n); ++i)
        printf(i == n - 1 ? "%d\n" : "%d ", num[i]);
    } else if (!sum || zero == n)
      printf("NO\n");
    else if (!fu || !zheng) {
      printf("YES\n");
      for (int i = (0); i < (n); ++i)
        if (num[i]) printf("%d ", num[i]);
      for (int i = (0); i < (zero); ++i) printf(i == zero - 1 ? "0\n" : "0 ");
    } else {
      printf("YES\n");
      sort(a.begin(), a.end());
      sort(b.begin(), b.end());
      if (sum < 0) {
        int cnt = 0, aa = 0, bb = 0, tmp = 0;
        while (bb < fu) {
          if (bb < fu) {
            c[cnt] = b[bb];
            tmp += b[bb];
            ++cnt, ++bb;
          }
          while (aa < zheng && tmp + a[aa] < 0)
            tmp += a[aa], c[cnt] = a[aa], ++cnt, ++aa;
        }
        if (zero) {
          for (int i = (0); i < (cnt); ++i) printf("%d ", c[i]);
          for (int i = (0); i < (zero); ++i)
            printf(i == zero - 1 ? "0\n" : "0 ");
        } else
          for (int i = (0); i < (cnt); ++i)
            printf(i == cnt - 1 ? "%d\n" : "%d ", c[i]);
      } else {
        int cnt = 0, aa = zheng - 1, bb = fu - 1, tmp = 0;
        while (aa >= 0) {
          if (aa >= 0) {
            c[cnt] = a[aa];
            tmp += a[aa];
            ++cnt, --aa;
          }
          while (bb >= 0 && tmp + b[bb] > 0)
            tmp += b[bb], c[cnt] = b[bb], ++cnt, --bb;
        }
        if (zero) {
          for (int i = (0); i < (cnt); ++i) printf("%d ", c[i]);
          for (int i = (0); i < (zero); ++i)
            printf(i == zero - 1 ? "0\n" : "0 ");
        } else
          for (int i = (0); i < (cnt); ++i)
            printf(i == cnt - 1 ? "%d\n" : "%d ", c[i]);
      }
    }
  }
  return 0;
}
