#include <bits/stdc++.h>
using namespace std;
int resolve(long long int n) {
  long long int num, i;
  vector<int> vect;
  for (i = 1; i <= n; i++) {
    cin >> num;
    vect.push_back(num);
  }
  for (i = 0; i < n - 1; i++) {
    if (vect[i] <= vect[i + 1]) return 1;
  }
  return 0;
}
int main() {
  long long int t, n, ans;
  cin >> t;
  while (t--) {
    cin >> n;
    ans = resolve(n);
    if (ans)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
