#include <bits/stdc++.h>
using namespace std;
void mainSolve() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  ;
  long long int yas = 0;
  for (int i = 0; i < n; i++) yas += v[i];
  bool pos = false;
  for (int i = 0; i < n; i++) {
    if (v[i] >= 0) pos = true;
  }
  if (!pos) {
    long long int adel = v[0];
    for (int i = 0; i < n; i++) adel = max(adel, v[i]);
    cout << (yas > adel ? "YES" : "NO") << '\n';
    return;
  }
  long long int adel = 0;
  long long int sum = 0;
  for (int i = 1; i < n; i++) {
    if (sum + v[i] < 0) {
      sum = 0;
      continue;
    }
    sum += v[i];
    adel = max(adel, sum);
  }
  sum = 0;
  for (int i = 0; i < n - 1; i++) {
    if (sum + v[i] < 0) {
      sum = 0;
      continue;
    }
    sum += v[i];
    adel = max(adel, sum);
  }
  cout << (yas > adel ? "YES" : "NO") << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    mainSolve();
  }
  return 0;
}
