#include <bits/stdc++.h>
#pragma optimize("SEX_ON_THE_BEACH")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
namespace someUsefull {
template <typename T1, typename T2>
inline void checkMin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void checkMax(T1& a, T2 b) {
  if (a < b) a = b;
}
const int _bitfunctions_size_ = 16;
const int _bitfunctions_mask_ = (1 << _bitfunctions_size_) - 1;
char* _bits_count_;
inline void _build_bits_count_() {
  _bits_count_ = new char[1 << _bitfunctions_size_];
  for (int i = 1; i < (1 << _bitfunctions_size_); ++i) {
    _bits_count_[i] = _bits_count_[i >> 1];
    if (i & 1) ++_bits_count_[i];
  }
}
template <typename T1 = char, typename T2 = int>
inline T1 popcnt(T2 x) {
  T1 ans = 0;
  while (x) {
    ans += _bits_count_[x & _bitfunctions_mask_];
    x >>= _bitfunctions_size_;
  }
  return ans;
}
}  // namespace someUsefull
namespace operators {
template <typename T1, typename T2>
std::istream& operator>>(std::istream& in, std::pair<T1, T2>& x) {
  in >> x.first >> x.second;
  return in;
}
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& out, std::pair<T1, T2> x) {
  out << x.first << " " << x.second;
  return out;
}
template <typename T1>
std::istream& operator>>(std::istream& in, std::vector<T1>& x) {
  for (auto& i : x) in >> i;
  return in;
}
template <typename T1>
std::ostream& operator<<(std::ostream& out, std::vector<T1>& x) {
  for (auto& i : x) out << i << " ";
  return out;
}
}  // namespace operators
using namespace std;
using namespace operators;
using namespace someUsefull;
void solve(int test = 0) {
  int n;
  cin >> n;
  vector<int> arr(n);
  cin >> arr;
  vector<int> up(n), down(n);
  up[0] = 0;
  down[0] = arr[0];
  for (int i = 1; i < n; ++i) {
    down[i] = min(down[i - 1], arr[i] - up[i - 1]);
    up[i] = arr[i] - down[i];
  }
  0;
  ;
  0;
  ;
  if (!is_sorted(up.begin(), up.end()) ||
      !is_sorted(down.rbegin(), down.rend()) || down.back() < 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  _build_bits_count_();
  cout << setprecision(15);
  int t = 1;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    0;
    ;
    solve(i + 1);
  }
  return 0;
}
