#include <bits/stdc++.h>
using namespace std;
long long n;
void gg(long long &cnt, long long k) {
  while (n % k == 0) {
    n /= k;
    cnt++;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (auto &x : v) cin >> x;
    bool p = 0;
    for (long long i = 0; i < n - 1; i++) {
      if (v[i] <= v[i + 1]) p = 1;
    }
    if (p)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
