#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n + 5];
    map<long long int, long long int> ma;
    long long int i;
    long long int sum = 0;
    long long int flag = 0;
    long long int maxsum = -100000000000000000;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] < 0) {
        flag = 1;
      }
      sum += a[i];
      maxsum = (a[i] > maxsum ? a[i] : maxsum);
    }
    long long int currsum = 0;
    for (i = 0; i < n - 1; i++) {
      currsum = (0 > currsum + a[i] ? 0 : currsum + a[i]);
      maxsum = (maxsum > currsum ? maxsum : currsum);
    }
    currsum = 0;
    for (i = 1; i < n; i++) {
      currsum = (0 > currsum + a[i] ? 0 : currsum + a[i]);
      maxsum = (maxsum > currsum ? maxsum : currsum);
    }
    if (sum <= maxsum) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
