#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int main();
void file() {}
void time() {}
const int INF = 1e9 + 90;
const long long int LINF = 1e18 + 90;
using pii = pair<int, int>;
using vec = vector<int>;
void solve() {
  int n;
  cin >> n;
  vector<long long int> v(n);
  long long int yasser = 0;
  for (auto& x : v) cin >> x, yasser += x;
  vector<long long int> cum(n + 1);
  for (int i = 1; i <= n; i++) {
    cum[i] = cum[i - 1] + v[i - 1];
  }
  debug() << " ["
          << "cum"
             ": "
          << (cum) << "] ";
  long long int ans = -INF;
  long long int l = 0;
  for (int i = 1; i < n; i++) {
    ans = max(ans, cum[i] - cum[l]);
    if (cum[i] < cum[l]) l = i;
  }
  l = 1;
  for (int i = 2; i <= n; i++) {
    ans = max(ans, cum[i] - cum[l]);
    if (cum[i] < cum[l]) l = i;
  }
  debug() << " ["
          << "ans"
             ": "
          << (ans) << "] ";
  if (ans < yasser)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
