#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long test;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    bool poss = false;
    for (long long i = 0; i < n - 1; i++) {
      if (a[i + 1] >= a[i]) {
        poss = true;
        break;
      }
    }
    if (!poss) {
      cout << "NO" << '\n';
    } else {
      cout << "YES" << '\n';
    }
  }
}
