#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const long long INF = 1e18;
signed main() {
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    deque<long long> smth;
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
      if (i > 0) smth.push_back(a[i]);
    }
    n--;
    vector<long long> pref(n + 1, 0);
    for (long long i = 1; i <= n; i++) {
      pref[i] = pref[i - 1] + smth[i - 1];
    }
    long long mi = pref[0], i_best = 0, ma = -INF, j_best = 1, ans_l = 0,
              ans_r = 0;
    for (long long j = 1; j <= n; j++) {
      if (pref[j] - mi > ma) {
        ma = pref[j] - mi;
        ans_l = i_best;
        ans_r = j;
      }
      if (pref[j] < mi) {
        mi = pref[j];
        i_best = j;
      }
    }
    long long res = ma;
    smth.pop_back();
    smth.push_front(a[0]);
    pref.resize(n + 1, 0);
    for (long long i = 1; i <= n; i++) {
      pref[i] = pref[i - 1] + smth[i - 1];
    }
    mi = pref[0], i_best = 0, ma = -INF, j_best = 1, ans_l = 0, ans_r = 0;
    for (long long j = 1; j <= n; j++) {
      if (pref[j] - mi > ma) {
        ma = pref[j] - mi;
        ans_l = i_best;
        ans_r = j;
      }
      if (pref[j] < mi) {
        mi = pref[j];
        i_best = j;
      }
    }
    res = max(res, ma);
    if (res >= sum) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
}
