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