#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tt;
  cin >> tt;
  while (tt--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (auto &i : v) cin >> i;
    bool ans = false;
    for (size_t i = 0; i < n; i++) {
      if (v[i] >= v[i - 1]) {
        ans = true;
        break;
      }
    }
    cout << ((ans) ? "YES" : "NO") << "\n";
  }
}
