#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long x, y, z, a, b, c, sum, ans, total, t, cnt, n, m, k, p, kase;
string s1, s2;
map<long long, long long> mp;
set<long long> s;
map<long long, long long>::iterator itr1, ptr1;
set<long long>::iterator itr, ptr;
int main() {
  ;
  cin >> t;
  while (t--) {
    cin >> n;
    v.resize(n);
    vector<long long> v1, v2;
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
    }
    if (v[n - 1] > v[0])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
