#include <bits/stdc++.h>
using namespace std;
long long int m = 998244353;
long long int modularExponentiation(long long int x, long long int n) {
  x = abs(x);
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x), n / 2) % m;
  else
    return (x * (modularExponentiation((x * x) % m, (n - 1) / 2))) % m;
}
long long int GCD(long long int a, long long int b) {
  if (a == 0) return b;
  return GCD(b % a, a);
}
int num(int n, int m, int x, int y) {
  int ans = 0;
  if (x - 1 >= 0) ans++;
  if (x + 1 < n) ans++;
  if (y - 1 >= 0) ans++;
  if (y + 1 < m) ans++;
  return ans;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n], left, right, last = 0;
    left = 1000000;
    right = 1000000;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    if (a[0] < a[n - 1])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
