#include <bits/stdc++.h>
using namespace std;
long long SetBit(long long n, long long X) { return n | (1LL << X); }
long long ClearBit(long long n, long long X) { return n & ~(1LL << X); }
long long ToggleBit(long long n, long long X) { return n ^ (1LL << X); }
bool CheckBit(long long n, long long X) { return (bool)(n & (1LL << X)); }
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const int kx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int ky[] = {-1, 1, -2, 2, -2, 2, -1, 1};
const int Kx[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int Ky[] = {-1, 1, 0, 0, 1, 1, -1, -1};
const int MAX = 3e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const long long LINF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc;
  cin >> tc;
  for (int R = 1; R <= tc; R++) {
    int n;
    cin >> n;
    int a[n + 5];
    for (int i = 1; i <= n; i++) cin >> a[i];
    int mx = a[n], mn = a[1];
    if (mn > mx)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
