#include <bits/stdc++.h>
using namespace std;
long long int flg = 1;
long long int mx(long long int a[], long long int size, long long int ys) {
  long long int max_so_far = -(1e16), max_ending_here = 0, start = 0, end = 0,
                s = 0;
  for (long long int i = 1; i < size; i++) {
    max_ending_here += a[i];
    if (max_so_far < max_ending_here) {
      max_so_far = max_ending_here;
      start = s;
      end = i;
    }
    if (max_ending_here < 0) {
      max_ending_here = 0;
      s = i + 1;
    }
  }
  long long int mx = max_so_far;
  max_so_far = -(1e16), max_ending_here = 0, start = 0, end = 0, s = 0;
  for (long long int i = 0; i < size - 1; i++) {
    max_ending_here += a[i];
    if (max_so_far < max_ending_here) {
      max_so_far = max_ending_here;
      start = s;
      end = i;
    }
    if (max_ending_here < 0) {
      max_ending_here = 0;
      s = i + 1;
    }
  }
  return max(mx, max_so_far);
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  long long int kk = 0;
  long long int flg = 1;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    kk += a[i];
  }
  long long int k = mx(a, n, kk);
  if (k < kk)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
int main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
