#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " | ";
  err(++it, args...);
}
vector<long long int> v1, v2;
string s1, s2, s3;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int a, b, c, d, e, f, i, j, k, cnt1 = 0, cnt2 = 0, sum1 = 0,
                                           sum2 = 0, chk1 = 0, chk2 = 0, T;
  cin >> T;
  while (T--) {
    v1.clear();
    cin >> a;
    for (i = 0; i < a; i++) {
      cin >> b;
      v1.push_back(b);
    }
    if (v1[0] < v1.back()) {
      cout << "YES" << '\n';
    } else {
      cout << "NO" << '\n';
    }
  }
  return 0;
}
