#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i;
  long s1, s2;
  cin >> t;
  while (t--) {
    cin >> n;
    int a[n + 5];
    s1 = 0, s2 = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (i = 1; i < n; i++) {
      if (a[i] > a[i - 1]) {
        s1 = s1 + (a[i] - a[i - 1]);
      } else {
        s2 = s2 + (a[i - 1] - a[i]);
      }
    }
    if (s1 > s2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
