#include <bits/stdc++.h>
using namespace std;
int t;
int n;
int a[50011];
int read() {
  int _ = 1, __ = 0;
  char ___;
  ___ = getchar();
  while (___ > '9' || ___ < '0') {
    if (___ == '-') _ = -1;
    ___ = getchar();
  }
  while (___ <= '9' && ___ >= '0') {
    __ = __ * 10 + ___ - '0';
    ___ = getchar();
  }
  return _ * __;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> n;
    int flag = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (int i = 1; i < n; i++) {
      if (a[i] <= a[i + 1]) {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
