#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
const long long int mxn = 1e5 + 7;
long long int a[mxn];
long long int power(long long int a, long long int b);
long long int flcm(long long int n, long long int m);
long long int fgcd(long long int n, long long int m);
long long int modinv(long long int x);
long long int max_val(long long int start, long long int end) {
  long long int pres_max, global_max;
  for (long long int i = start; i <= end; i++) {
    if (i == start) {
      pres_max = a[i];
      global_max = a[i];
    } else {
      pres_max = max(pres_max + a[i], a[i]);
      global_max = max(global_max, pres_max);
    }
  }
  return global_max;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, k, u, v, t = 1, temp, ans = 0, flag = 1, c = 0, min_el,
                               max_el, sum_el;
  string s, s1, s2;
  cin >> t;
  while (t--) {
    ans = 0;
    c = 0;
    flag = 1;
    sum_el = 0;
    cin >> n;
    memset(a, 0, sizeof(a));
    for (long long int i = 0; i < n; i++) cin >> a[i];
    max_el = max(max_val(0, n - 2), max_val(1, n - 1));
    if (max_el < max_val(0, n - 1))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
long long int power(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
long long int flcm(long long int n, long long int m) {
  long long int temp = fgcd(n, m);
  return (n * m) / temp;
}
long long int fgcd(long long int n, long long int m) {
  long long int temp;
  while (m != 0) {
    temp = n;
    n = m;
    m = temp % m;
  }
  return n;
}
long long int modinv(long long int x) { return power(x, mod - 2); }
