#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long a[(long long)1e6];
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long s = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      s += a[i];
    }
    long long cs = 0;
    long long bs = 0;
    for (long long i = 0; i < n - 1; i++) {
      cs += a[i];
      if (cs <= 0) {
        cs = 0;
      }
      bs = max(bs, cs);
    }
    if (cs <= 0) {
      cs = 0;
    }
    bs = max(bs, cs);
    cs = 0;
    for (long long i = 1; i < n; i++) {
      cs += a[i];
      if (cs <= 0) {
        cs = 0;
      }
      bs = max(bs, cs);
    }
    if (cs <= 0) {
      cs = 0;
    }
    bs = max(bs, cs);
    if (s > bs)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
