#include <bits/stdc++.h>
using namespace std;
vector<long long int> primes;
void SOE(long long int n) {
  primes.erase(primes.begin(), primes.end());
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) {
      primes.push_back(p);
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int i, c = 0, j, k, t, f = 0, q, n, f1 = 0, y, x, m, l = 0, r, p;
  string s, s1, s2;
  cin >> t;
  while (t--) {
    cin >> n;
    long long int a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    a[0] < a[n - 1] ? cout << "YES\n" : cout << "NO\n";
  }
}
