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