#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, r = 0, a[100000];
    cin >> n;
    for (long long i = 1; i <= n; i++) cin >> a[i];
    for (long long i = 1; i <= n - 1; i++) {
      if (a[i] <= a[i + 1]) {
        r = 1;
        break;
      }
    }
    if (r == 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
