#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5;
int a[MAXN];
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  int n;
  for (int t = 1; t <= T; t++) {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    bool canMake = (a[0] < a[n - 1]);
    if (canMake)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
