#include <bits/stdc++.h>
namespace competitive_programming::utility {
class timer {
 private:
  std::chrono::time_point<std::chrono::steady_clock> begin, end;

 public:
  timer() : begin(), end() {}
  ~timer() {}
};
}  // namespace competitive_programming::utility
constexpr bool test_cases = true;
auto solve = []() -> void {
  int n;
  std::cin >> n;
  std::vector<int> a(n + 1), diff(n + 1);
  for (int i = 1; i <= n; ++i) {
    std::cin >> a[i];
    diff[i] = a[i] - a[i - 1];
  }
  int max = diff[1];
  for (int i = 2; i <= n; ++i) {
    if (diff[i] < 0 && max + diff[i] >= 0) {
      max += diff[i];
      diff[i] = 0;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (diff[i] < 0) {
      std::cout << "NO" << '\n';
      return;
    }
  std::cout << "YES" << '\n';
};
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.precision(10);
  std::cerr.precision(10);
  std::cout << std::fixed << std::boolalpha;
  std::cerr << std::fixed << std::boolalpha;
  competitive_programming::utility::timer t;
  int32_t cases = 1;
  if (test_cases) std::cin >> cases;
  while (cases--) solve();
  return 0;
}
