#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int64_t t;
  cin >> t;
  while (t--) {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), dp(n);
    for (int64_t i = 0; i < n; i++) {
      cin >> a[i];
    }
    int64_t max_dp = dp[0] = a[0];
    int64_t pos = 0;
    bool neg = (a[0] <= 0);
    for (int64_t i = 1; i < n; i++) {
      dp[i] = max(a[i], a[i] + dp[i - 1]);
      if (max_dp < dp[i]) {
        max_dp = dp[i];
        pos = i;
      }
      if (dp[i] <= 0) {
        neg = true;
      }
    }
    if ((pos == n - 1 && neg) || pos != n - 1) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
}
