#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
long long int fast_pow(long long int base, long long int exp,
                       long long int M = 1000000007) {
  base = base % M;
  long long int result = 1;
  while (exp > 0) {
    if (exp % 2 == 1) result = (result * base) % M;
    base = (base * base) % M;
    exp = exp / 2;
  }
  return result;
}
long long int modInverse(long long int A, long long int M = 1000000007) {
  return fast_pow(A, M - 2, M);
}
long long int maxSubArraySum(long long int a[], long long int size) {
  long long int max_so_far = INT_MIN, max_ending_here = 0;
  for (long long int i = 0; i < size; i++) {
    max_ending_here = max_ending_here + a[i];
    if (max_so_far < max_ending_here) max_so_far = max_ending_here;
    if (max_ending_here < 0) max_ending_here = 0;
  }
  return max_so_far;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    long long int yass = 0;
    cin >> n;
    long long int v[n];
    for (long long int i = 0; i <= n - 1; i++) {
      cin >> v[i];
      yass += v[i];
    }
    long long int m1 = maxSubArraySum(v, n - 1);
    long long int m2 = maxSubArraySum(v + 1, n - 1);
    ;
    long long int adel = max(m1, m2);
    if (yass > adel) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
