#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test;
  cin >> test;
  while (test--) {
    cin >> n;
    for (int i = 1, _c = n; i <= n; ++i) cin >> a[i];
    if (a[1] < a[n])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
