#include <bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> vec(n);
    for (long long &i : vec) cin >> i;
    int flag = 0;
    for (int i = 1; i < n; i++) {
      if (vec[i] >= vec[i - 1]) {
        flag = 1;
        break;
      }
    }
    if (flag == 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
