#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
long long counter = 0;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<int> cubes(n);
    for (int i = 0; i < n; i++) {
      cin >> cubes[i];
    }
    bool can = false;
    for (int i = 1; i < n; i++) {
      if (cubes[i] >= cubes[i - 1]) {
        can = true;
        break;
      }
    }
    if (can == true)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
