#include <bits/stdc++.h>
using namespace std;
int n, arr[100], sum;
int mulMod(long long, long long);
int addMod(int, int);
void readArray(int *, int);
void printArray(int *, int);
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    sum = 0;
    readArray(arr, n);
    if (!sum)
      printf("NO\n");
    else {
      vector<int> neg, pos, zero;
      int p = 0, nn = 0;
      for (int i = 0; i < n; i++) {
        if (arr[i] > 0) {
          pos.push_back(arr[i]);
          p += arr[i];
        } else if (arr[i] == 0)
          zero.push_back(arr[i]);
        else {
          neg.push_back(arr[i]);
          nn += arr[i];
        }
      }
      printf("YES\n");
      if (abs(p) > abs(nn)) {
        for (auto x : pos) cout << x << " ";
        for (auto x : neg) cout << x << " ";
        for (auto x : zero) cout << x << " ";
        cout << endl;
      } else {
        for (auto x : neg) cout << x << " ";
        for (auto x : pos) cout << x << " ";
        for (auto x : zero) cout << x << " ";
        cout << endl;
      }
    }
  }
  return 0;
}
int mulMod(long long a, long long b) {
  a *= b;
  a %= 1000000007;
  return (int)a;
}
int addMod(int a, int b) {
  long long c = a + b;
  if (c >= 1000000007) {
    c -= 1000000007;
  }
  return (int)c;
}
void readArray(int *nums, int n) {
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
    sum += nums[i];
  }
}
void printArray(int *nums, int n) {
  for (int i = 0; i < n; i++) cout << nums[i] << " ";
  cout << endl;
}
