#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll t;
  cin >> t;
  while (t--) {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
      cin >> a[i];
    }
    bool strictly_decreasing = true;
    for (ll i = 1; i < n; i++) {
      if (a[i] >= a[i - 1]) {
        strictly_decreasing = false;
        break;
      }
    }
    if (strictly_decreasing) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
