#include <bits/stdc++.h>
using namespace std;
long long q, np, nn, n, a[300004], z, x;
map<long long, long long> mp;
vector<long long> vec;
bool f;
int main() {
  ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  cin >> q;
  while (q--) {
    f = 0;
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
    }
    if (a[1] < a[n]) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
