#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tests;
  cin >> tests;
  while (tests--) {
    int n;
    cin >> n;
    int first = 0, last = 0;
    for (int i = 0; i < n; i++) {
      int val;
      cin >> val;
      if (i == 0) first = val;
      if (i == n - 1) last = val;
    }
    if (first < last)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
