#include <bits/stdc++.h>
using namespace std;
long long t, n, a[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    bool b = 0;
    for (int i = 1; i < n; i++) {
      if (a[i - 1] <= a[i]) {
        b = 1;
        break;
      }
    }
    if (b == 0)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
