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