#include <bits/stdc++.h>
using namespace std;
int factorial(int n);
int factorial(int n) {
  if (n == 1) {
    return 1;
  } else {
    return n * factorial(n - 1);
  }
}
bool is_prime(long long n) {
  if (n == 1) {
    return false;
  }
  long long i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    i += 1;
  }
  return true;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int check(int x, vector<int> a, int n) {
  int county = 0;
  map<int, int> mapa;
  for (int i = 0; i < n; i++) {
    mapa.insert(pair<int, int>(a[i], 0));
  }
  for (int i = 0; i < n; i++) {
    mapa[a[i]]++;
  }
  for (int i = 0; i < a.size(); i++) {
    mapa[a[i]]--;
    if (mapa[abs(a[i] - x)] > 0) {
      county++;
      mapa[abs(a[i] - x)]--;
    }
  }
  return county;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t > 0) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    if (a[0] <= 0 || a[n - 1] <= 0) {
      cout << "NO" << endl;
    } else {
      long long sum = 0;
      int i;
      for (i = 0; i < n - 1; i++) {
        sum = sum + a[i];
        if (sum <= 0) {
          break;
        }
      }
      long long sum2 = 0;
      int j;
      for (j = n - 1; j > 0; j--) {
        sum2 = sum2 + a[j];
        if (sum2 <= 0) {
          break;
        }
      }
      if (i == n - 1 && j == 0) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
    t--;
  }
}
