#include <bits/stdc++.h>
using namespace std;
vector<int> arr, hgt, res;
int n;
int func(int i, int j) {}
int main() {
  int a, b, c, d, e, f, g;
  cin >> a;
  while (a--) {
    cin >> b;
    vector<int> num;
    for (int i = 0; i < b; i++) {
      cin >> c;
      num.push_back(c);
    }
    if (num[b - 1] < num[0]) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
    num.clear();
  }
}
