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