#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const long double pi = 2 * acos(0.0);
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, c = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    ;
    for (int i = 0; i < n - 1; i++) {
      if (a[i] <= a[i + 1]) {
        c = 1;
        break;
      }
    }
    if (c == 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
