#include <bits/stdc++.h>
using namespace std;
int t, n;
long long dp[200100][3], sum, a[200100];
bool vis[200100][2];
long long Solve(int i, int j) {
  if (i == n) return 0;
  long long &ret = dp[i][j];
  if (vis[i][j]) return ret;
  vis[i][j] = 1;
  if (j)
    ret = 0;
  else
    ret = max(Solve(i + 1, 1) + a[i], Solve(i + 1, 0) + a[i]);
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    long long mx = -1e18;
    sum = 0;
    for (int i = 0; i <= n; i++) vis[i][0] = vis[i][1] = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
      if (i != n - 1) mx = max(mx, sum);
    }
    for (int i = 1; i < n; i++) mx = max(mx, Solve(i, 0));
    if (sum > mx)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
