#include <bits/stdc++.h>
const int N = (int)1e5 + 7;
const int MOD = (int)1e9 + 7;
const long long INF = (long long)1e18;
using namespace std;
bool solve(vector<int> &A, int n) {
  for (int i = 1; i < n; i++) {
    if (A[i] > A[i - 1]) {
      return true;
    }
  }
  for (int i = 1; i < n; i++) {
    if (A[i] == A[i - 1]) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; i++) cin >> A[i];
    cout << (solve(A, n) ? "YES" : "NO") << '\n';
  }
  return 0;
}
