#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long temp = 0, flag = 0, diff = 0, sum = 0, result = 0, ct = 0,
              cnt = 0, found = 0;
    long long a = 0, b = 0, c = 0, n = 0, m = 0, k = 0, x = 0, y = 0;
    set<long long> s1;
    map<long long, long long> mapp;
    std::vector<long long> v, v1, v2;
    string s;
    cin >> n;
    for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 1 - 2 * ((0) > (n))) {
      cin >> a;
      v.push_back(a);
    }
    v[n - 1] > v[0] ? cout << "YES" : cout << "NO";
    cout << '\n';
  }
  return 0;
}
