#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n + 10], premin[n + 10], postmax[n + 10];
    for (int i = 0; i < n; i++) cin >> arr[i];
    bool ok = 0;
    if (arr[n - 1] > arr[0]) ok = 1;
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
