#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;
    int flg = 1;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] <= 0) flg = 0;
      sum += a[i];
    }
    int i = 0;
    long long maxx = -1;
    int max_l = 0, max_r = -1;
    long long tmp = 0;
    while (i < n) {
      if (a[i] >= 0) {
        tmp += a[i];
        max_r = i;
      } else {
        maxx = max(maxx, tmp);
        max_l = i + 1;
        tmp = 0;
      }
      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 << "NO" << endl;
      else
        cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
