#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, sum = 0, curMax = -2e9, cur = 0;
    cin >> n;
    long long arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i], sum += arr[i];
    for (int i = 0; i < n - 1; i++) {
      cur += arr[i];
      curMax = max(curMax, cur);
      if (cur < 0) cur = 0;
    }
    cur = 0;
    for (int i = 1; i < n; i++) {
      cur += arr[i];
      curMax = max(curMax, cur);
      if (cur < 0) cur = 0;
    }
    cout << (sum > curMax ? "YES\n" : "NO\n");
  }
  return 0;
}
