#include <bits/stdc++.h>
using namespace std;
long long int t, n, tots, tot, sum, maxi1, maxi2;
long long int a[100005];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    tot = 0;
    tots = 0;
    sum = 0;
    maxi1 = 0;
    maxi2 = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      tots += a[i];
      if (a[i] < 0) tot++;
    }
    if (tot == n)
      cout << "NO\n";
    else {
      for (int i = 1; i <= n - 1; i++) {
        if (sum + a[i] > 0) {
          sum += a[i];
          if (sum > maxi1) {
            maxi1 = sum;
          }
        } else
          sum = 0;
      }
      sum = 0;
      for (int i = 2; i <= n; i++) {
        if (sum + a[i] > 0) {
          sum += a[i];
          if (sum > maxi2) {
            maxi2 = sum;
          }
        } else
          sum = 0;
      }
      if (tots > max(maxi1, maxi2))
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
