#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
long long a[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    memset(a, 0, sizeof(a));
    int n;
    cin >> n;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    int i = 0;
    long long maxx = -1;
    int max_l = 0, max_r = 0;
    long long tmp = 0;
    while (i < n) {
      if (a[i] > 0) {
        tmp += a[i];
        if (maxx < tmp) {
          maxx = tmp;
          max_r = i;
        }
      } else {
        if (tmp + a[i] <= 0) {
          tmp = 0;
          max_l = i;
        } else {
          tmp += a[i];
        }
      }
      i++;
    }
    maxx = max(maxx, tmp);
    if (sum > maxx)
      cout << "YES" << endl;
    else if (sum == maxx) {
      while (!a[max_l]) max_l++;
      while (!a[max_r]) max_r--;
      if (max_l == 0 && max_r == n - 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    } else
      cout << "NO" << endl;
  }
}
