#include <bits/stdc++.h>
using namespace std;
const int N = 5e4 + 10;
int t, n, a[N];
bool ok;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    ok = false;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      if (i && a[i - 1] <= a[i]) ok = true;
    }
    if (ok)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
