#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    ll a[n], dp[n];
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      sum += a[i];
      if (i == 0)
        dp[i] = a[i];
      else {
        dp[i] = max(a[i], a[i] + dp[i - 1]);
      }
    }
    ll suf = a[n - 1];
    dp[n - 1] = a[n - 1];
    for (int i = n - 2; i > 0; --i) {
      suf += a[i];
      dp[n - 1] = max(dp[n - 1], suf);
    }
    ll m = *max_element(dp, dp + n);
    if (m < sum)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
