#include <bits/stdc++.h>
using namespace std;
long long max_sum(int *a, int l, int r) {
  long long ans = a[0], sum = 0;
  for (int i = l; i < r; i++) {
    sum += a[i];
    ans = max(ans, sum);
    sum = max(sum, 0LL);
  }
  return ans;
}
int main() {
  int t, n, a[100000];
  long long s1, s2;
  cin >> t;
  while (t--) {
    cin >> n;
    s1 = 0;
    for (int i = 0; i < n && cin >> a[i]; i++) {
      s1 += a[i];
    }
    s2 = max_sum(a, 0, n - 1);
    s2 = max(s2, max_sum(a, 1, n));
    if (s1 > s2) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
