#include <bits/stdc++.h>
using namespace std;
int sorted(vector<int> a) {
  bool sorted = 1;
  for (int i = 1; i < a.size(); i++) {
    if (a[i] >= a[i - 1]) {
      sorted = 0;
      break;
    }
  }
  return sorted;
}
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    if (sorted(a)) {
      cout << "NO\n";
    } else
      cout << "YES\n";
  }
  return 0;
}
