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