#include <bits/stdc++.h>
const int mod = 1000000007;
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long powM(long long a, long long n, long long m) {
  if (!n) return 1;
  long long x = powM(a, n >> 1, m);
  x = x * x % m;
  if (n & 1) x = (x * a) % m;
  return x;
}
void myFactorial(long long int n, vector<long long int> &dp) {
  long long int f = 1;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    f = (f * i);
    dp[i] = f;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; ++i) cin >> arr[i];
    bool rev = true;
    for (int i = 0; i < n - 1; ++i) {
      if (arr[i] <= arr[i + 1]) {
        rev = false;
        break;
      }
    }
    if (rev)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
