#include <bits/stdc++.h>
using namespace std;
int t, n, v[300300];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> v[i];
    if (v[1] < v[n])
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
}
