#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long T = 1;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    int c = 0;
    for (int i = 1; i < n; i++) {
      if (a[i - 1] > a[i])
        continue;
      else {
        c++;
        break;
      }
    }
    if (c == 0)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
