#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int t = 0; t < T; t++) {
    int N;
    cin >> N;
    string ans = "YES";
    vector<long long> a(N);
    for (int i = 0; i < N; i++) {
      cin >> a[i];
    }
    if (a[0] > a[N - 1]) ans = "NO";
    cout << ans << endl;
  }
  return 0;
}
