#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<int> calcZFunction(string &s) {
  int n = s.size();
  vector<int> ans(n);
  int l = 0, r = 0;
  for (int i = 1; i < n; i++) {
    if (i <= r) {
      ans[i] = min(ans[i - l], r - i + 1);
    }
    while (i + ans[i] < n && s[ans[i]] == s[i + ans[i]]) ans[i]++;
    if (i + ans[i] - 1 > r) {
      l = i;
      r = i + ans[i] - 1;
    }
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  if (v[0] < v[n - 1])
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
