#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int prev = int(1e9) + 1, x;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    cin >> x;
    ok &= (x < prev);
    prev = x;
  }
  cout << (ok ? "NO" : "YES") << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
