#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int Inf = 1e9 + 5;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    ll mx = 0, s = 0;
    for (int i = 1; i < n; i++) {
      s += a[i];
      if (s < 0) s = 0;
      mx = max(mx, s);
    }
    bool f1 = 0;
    if (sum > mx) {
      f1 = 1;
    }
    mx = 0;
    s = 0;
    for (int i = 0; i < n - 1; i++) {
      s += a[i];
      if (s < 0) s = 0;
      mx = max(mx, s);
    }
    if (sum > mx && f1) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
