#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int mx = 3e5 + 5;
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  bool flag = true;
  for (int i = (int)1; i < (int)n; i++) {
    if (v[i] >= v[i - 1]) {
      flag = false;
      break;
    }
  }
  if (!flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    solve();
  }
}
