#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 100;
void solve() {
  int n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int chek = n * (n - 1) / 2 - 1;
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (arr[i] > arr[i + 1]) ans++;
  }
  if (ans != n - 1)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
};
