#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
const long long mod = 1e9 + 7;
const double E = 1e-7;
int v[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> v[i];
  bool ok = 0;
  for (int i = 0; i < n - 1; i++) ok |= (v[i] <= v[i + 1]);
  cout << (ok ? "YES" : "NO") << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
