#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int f = 1;
    int n;
    cin >> 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]) f = 0;
    }
    cout << (f ? "NO" : "YES") << "\n";
    ;
  }
  return 0;
}
