#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n);
    bool ok = 1;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      if (i and v[i] >= v[i - 1]) ok = 0;
    }
    cout << (ok ? "NO\n" : "YES\n");
  }
  return 0;
}
