#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 10;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
long long n, t, a[maxn], permn[maxn], sufmx[maxn];
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) cin >> a[i];
    if (a[1] < a[n])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
