#include <bits/stdc++.h>
template <typename Iter>
long long maxsum(Iter begin, Iter end) {
  long long mins = 0, s = 0;
  long long maxs = 0;
  long long max = *begin;
  while (begin != end) {
    s += *begin;
    max = std::max(max, *begin);
    maxs = std::max(maxs, s - mins);
    mins = std::min(mins, s);
    ++begin;
  }
  return (maxs == 0 ? max : maxs);
}
int main() {
  int t;
  std::cin >> t;
  for (int ti = 0; ti < t; ++ti) {
    int n;
    std::cin >> n;
    std::vector<long long> a(n);
    for (auto &e : a) std::cin >> e;
    long long maxs = std::max(maxsum(a.begin(), a.end() - 1),
                              maxsum(a.begin() + 1, a.end()));
    std::cout << (std::accumulate(a.begin(), a.end(), 0ll) > maxs ? "YES"
                                                                  : "NO")
              << "\n";
  }
  return 0;
}
