#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
int n;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    v.clear();
    cin >> n;
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    if (v[0] < v[v.size() - 1])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
