#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
const long long INF = 1e18;
template <typename T>
inline void read(T &x) {
  int ch = getchar();
  x = 0;
  bool f = false;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = true;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  if (f) x = -x;
}
int t, n;
long long a[N];
int main() {
  read(t);
  while (t--) {
    read(n);
    for (register int i = 1; i <= n; i++) read(a[i]), a[i] += a[i - 1];
    long long now = INF, ans = 0;
    for (register int i = 1; i < n; i++)
      ans = max(ans, a[i] - min(now, 0ll)), now = min(now, a[i]);
    ans = max(ans, a[n] - now);
    puts(a[n] > ans ? "YES" : "NO");
  }
}
