#include <bits/stdc++.h>
using namespace std;
long long int n;
long long int arr[300005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tc;
  cin >> tc;
  for (long long int t = 1; t <= tc; t++) {
    cin >> n;
    for (long long int i = 0; i < n; i++) cin >> arr[i];
    if (arr[0] < arr[n - 1])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
