#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, t, a[300005];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for ((i) = 1; (i) <= (n); (i)++) scanf("%d", &a[i]);
    if (a[1] < a[n]) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
  return 0;
}
