#include <bits/stdc++.h>
using namespace std;
int v[50002];
int main() {
  int t, l, n, i, sol;
  cin >> t;
  for (l = 1; l <= t; l++) {
    cin >> n;
    sol = 0;
    for (i = 1; i <= n; i++) cin >> v[i];
    sol = 0;
    for (i = 1; i < n; i++)
      if (v[i] <= v[i + 1]) sol = 1;
    if (sol == 0)
      cout << "NO";
    else
      cout << "YES";
    cout << '\n';
  }
  return 0;
}
