#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> nums(n);
  vector<long long int> max_t(n);
  vector<long long int> is_r(n);
  vector<long long int> min_t(n);
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
  }
  if (nums[0] < nums[n - 1])
    cout << "YES"
         << "\n";
  else
    cout << "NO"
         << "\n";
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
