#include <bits/stdc++.h>
using namespace std;
long long llmax = numeric_limits<long long>::max();
long long llmin = numeric_limits<long long>::min();
long long mark[5010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(), cout.tie();
  long long t;
  cin >> t;
  while (t--) {
    long long n, a, b = 0;
    cin >> n;
    long long aa[n + 10];
    for (long long i = 0; i < n; i++) {
      cin >> aa[i];
    }
    if (aa[n - 1] > aa[0])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
