#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n - 1; i++) {
if (a[i] <= a[i + 1]) {
a[i + 1] -= a[i];
} else {
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHNvbHZlKCkgewoJaW50IG47CgljaW4gPj4gbjsKCXZlY3RvcjxpbnQ+IGEobik7Cglmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgY2luID4+IGFbaV07Cglmb3IgKGludCBpID0gMDsgaSA8IG4gLSAxOyBpKyspIHsKCQlpZiAoYVtpXSA8PSBhW2kgKyAxXSkgewoJCQlhW2kgKyAxXSAtPSBhW2ldOwoJCX0gZWxzZSB7CgkJCWNvdXQgPDwgIk5PIiA8PCBlbmRsOwoJCQlyZXR1cm47CgkJfQoJfQoJY291dCA8PCAiWUVTIiA8PCBlbmRsOwp9CgppbnQgbWFpbigpIHsKCWludCB0OwoJY2luID4+IHQ7Cgl3aGlsZSAodC0tKSBzb2x2ZSgpOwp9