#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    long long all = 0;
    for (auto &x : v) {
      cin >> x;
      all += x;
    }
    long long res = 0, cur = 0, bad1 = 0, bad2 = 0;
    long long cnt = 0;
    bool f1 = 0;
    for (auto x : v) {
      cur += x;
      if (cur < 0) bad1++;
      cnt++;
      if (cnt == n) {
        cur -= v[0];
        f1 = 1;
      }
      res = max(cur, res);
      if (cur < 0) {
        cur = 0;
      }
    }
    if (f1) {
      cur = 0;
      for (int i = 1; i < v.size(); i++) {
        cur += v[i];
        res = max(cur, res);
        if (cur < 0) {
          cur = 0;
        }
      }
    }
    if (bad1 == n) res = *max_element(v.begin(), v.end());
    if (all > res)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
