#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d\n", &t);
  for (int i = 0; i < t; i++) {
    int n;
    scanf("%d", &n);
    int a[n];
    int sum = 0;
    for (int j = 0; j < n; j++) {
      scanf("%d ", &a[j]);
      sum += a[j];
    }
    if (sum == 0)
      printf("NO\n");
    else if (sum > 0) {
      printf("YES\n");
      for (int j = 0; j < n; j++) {
        if (a[j] > 0) printf("%d ", a[j]);
      }
      for (int j = 0; j < n; j++) {
        if (a[j] <= 0) printf("%d ", a[j]);
      }
      printf("\n");
    } else {
      printf("YES\n");
      for (int j = 0; j < n; j++) {
        if (a[j] < 0) printf("%d ", a[j]);
      }
      for (int j = 0; j < n; j++) {
        if (a[j] >= 0) printf("%d ", a[j]);
      }
      printf("\n");
    }
  }
}
