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