#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> arr;
    for (long long int i = 0; i < n; i++) {
      long long int x;
      cin >> x;
      arr.push_back(x);
    }
    if (arr[n - 1] > arr[0])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
