#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    vector<Int> A(N);
    for (auto &a : A) cin >> a;
    Int yasser = accumulate(begin(A), end(A), 0LL);
    Int adel = LLONG_MIN, curr = 0;
    int l = 0, r = 0;
    for (int i = 0; i < N; i++) {
      curr += A[i];
      r = i;
      if (adel < curr && !(l == 0 && r == N - 1)) {
        adel = curr;
      }
      if (curr <= 0) {
        curr = 0;
        l = i + 1;
      }
    }
    cout << (yasser > adel ? "YES" : "NO") << '\n';
  }
  return 0;
}
