#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    int n, ans = 0;
    cin >> n;
    vector<int> v(n);
    for (auto &x : v) {
      cin >> x;
    }
    for (int i = 1; i < n; i++) {
      if (v[i - 1] <= v[i]) {
        ans = 1;
        break;
      }
    }
    cout << (ans == 1 ? "YES" : "NO") << endl;
  }
  return 0;
}
