#include <bits/stdc++.h>
using namespace std;
bool cal(long long a, long long b) {
  cout << a << " " << b << endl;
  if (a << 1 > b) return 1;
  b >>= 1;
  if (a << 1 > b) return (b - a) & 1;
  if (b & 1) return (b - a) & 1;
  return cal(a, b >> 1);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> s;
    int arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    if (arr[n - 1] > arr[0]) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
