#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long int solu() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long int mim = arr[0];
  long long int mum = arr[n - 1];
  if (mum > mim) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    solu();
  }
  return 0;
}
