#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MOD1 = 998244353;
const long long MIN_LL = -1e18;
const long long MAX_LL = 1e18;
const int MAX_INT = 1e9;
const int MIN_INT = -1e9;
const long double pie = 3.1415926535;
long long fpow(long long n, long long p) {
  ;
  long long m = 1;
  while (p) {
    if (p % 2) m *= n;
    p >>= 1;
    n *= n;
  }
  return m;
}
long long mfpow(long long n, long long p, long long M) {
  long long m = 1;
  n %= M;
  while (p) {
    if (p % 2) m = (m * n) % M;
    n = (n * n) % M;
    p >>= 1;
  }
  return m % M;
}
template <class T>
inline ostream& operator<<(ostream& o, vector<T> v) {
  for (auto i : v) o << i << " ";
  return o;
};
template <class T>
inline ostream& operator<<(ostream& o, set<T> s) {
  for (auto i : s) o << i << " ";
  return o;
}
template <class T>
inline ostream& operator<<(ostream& o, multiset<T> s) {
  for (auto i : s) cout << i << " ";
  return o;
}
template <class T1, class T2>
inline ostream& operator<<(ostream& o, pair<T1, T2> p) {
  o << p.first << " " << p.second << "\n";
  return o;
}
template <class T1, class T2>
inline ostream& operator<<(ostream& o, map<T1, T2> m) {
  for (auto p : m) o << p.first << " " << p.second << "\n";
  return o;
}
const vector<long long> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool br, br1, br2;
char ch, ch1, ch2;
long long n, m, k, x, y, z, mini, maxi, l, r, sum, t, w;
pair<long long, long long> p, p1, p2;
string s, s1, s2;
set<long long> st, st1, st2;
multiset<long long> mst;
map<long long, long long> mp;
long long a[(int)1e6 + 100];
long long fx(long long x, long long y) {
  long long main_maxi = MIN_LL;
  long long local_maxi = 0;
  for (int i = x; i < y; i++) {
    local_maxi += a[i];
    main_maxi = max(main_maxi, local_maxi);
    if (local_maxi < 0) local_maxi = 0;
  }
  return main_maxi;
}
void solve() {
  cin >> t;
  while (t--) {
    cin >> n;
    sum = 0;
    x = MIN_LL;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    if (sum > max({fx(1, n), fx(0, n - 1)}))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
