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