#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n + 5], flag = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (i && a[i - 1] <= a[i]) flag = 1;
    }
    cout << (flag ? "YES\n" : "NO\n");
  }
}
