#include <bits/stdc++.h>
using namespace std;
void test() { cerr << "\n"; }
template <typename T, typename... Args>
void test(T x, Args... args) {
  cerr << x << " ";
  test(args...);
}
const int MAXN = (int)1e6 + 5;
const int MOD = (int)1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0, ma = a[0], mi = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (i == 0) {
      mi = sum;
    } else {
      ma = max(ma, sum - mi);
      mi = min(mi, sum);
    }
    if (i != n - 1) ma = max(ma, sum);
  }
  cout << (sum > ma ? "YES" : "NO") << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
