#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, sum = 0, sum2 = 0;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      sum += v[i];
    }
    bool Z = true;
    for (int i = 1; i < n; i++) {
      sum2 += v[i];
      if (sum2 >= sum) Z = false;
      sum2 = max(sum2, (long long)0);
    }
    sum2 = 0;
    for (int i = 0; i < n - 1; i++) {
      sum2 += v[i];
      if (sum2 >= sum) Z = false;
      sum2 = max(sum2, (long long)0);
    }
    (Z) ? cout << "YES\n" : cout << "NO\n";
  }
  return 0;
}
