#include <bits/stdc++.h>
using namespace std;
using namespace std;
template <class T>
void setmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void setmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
T Abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline bool isPrime(T n) {
  if (n <= 1) return false;
  for (T i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
template <class T>
string toString(T n) {
  ostringstream oss;
  oss << n;
  oss.flush();
  return oss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
long long toLl(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double toDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
bool IsVowel(char ch) {
  ch = tolower(ch);
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  return false;
}
bool isUpperCase(char c) { return c >= 'A' && c <= 'Z'; }
bool isLowerCase(char c) { return c >= 'a' && c <= 'z'; }
long long Pow(long long B, long long P) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) R = (R * B);
    P /= 2;
    B = (B * B);
  }
  return R;
}
int BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (int)R;
}
long long mulmod(long long a, long long b, long long c) {
  long long x = 0, y = a % c;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x + y) % c;
    }
    y = (y * 2) % c;
    b /= 2;
  }
  return x % c;
}
void ASCII_Chart() {
  int i, j, k;
  printf("ASCII Chart:(30-129)\n");
  for (i = 30; i < 50; i++) {
    for (j = 0; j < 5; j++) {
      k = i + j * 20;
      printf("%3d---> '%c'   ", k, k);
    }
    printf("\n");
  }
}
double deg2rad(double x) { return (3.141592653589793 * x) / 180.0; }
double rad2deg(double x) { return (180.0 * x) / 3.141592653589793; }
struct Ind {
  long long x, y;
  Ind() {}
  Ind(long long xx, long long yy) {
    x = xx;
    y = yy;
  }
};
long long test, n, m;
string str;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> test;
  while (test--) {
    cin >> n;
    long long sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0, mx = 0;
    bool neg = false;
    for (int i = 0; i < n; i++) {
      cin >> m;
      sum1 += m;
      if (i) {
        sum3 += m;
        sum3 = max(sum3, 0LL);
      }
      if (i + 1 != n) {
        sum4 += m;
        sum4 = max(sum4, 0LL);
      }
      mx = max(mx, max(sum3, sum4));
    }
    if (sum1 > mx)
      cout << "YES" << '\n';
    else {
      cout << "NO" << '\n';
    }
  }
  return 0;
}
