#include <bits/stdc++.h>
using namespace std;
inline void solve() {
  int t;
  cin >> t;
  vector<long long> arr(t);
  for (auto &it : arr) cin >> it;
  if (arr.front() < arr.back())
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    solve();
  }
  return 0;
}
