#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a < b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) {
    cin >> i;
  }
  cout << (a[0] > a.back() ? "NO\n" : "YES\n");
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
