#include <bits/stdc++.h>
using namespace std;
inline long long int sbt(long long int x) { return __builtin_popcount(x); }
inline long long int mul(long long int a, long long int b,
                         long long int m = 1000000007) {
  return (a * b) % m;
}
inline long long int add(long long int a, long long int b,
                         long long int m = 1000000007) {
  return (a + b) % m;
}
inline long long int sub(long long int a, long long int b,
                         long long int m = 1000000007) {
  return (a - b + m) % m;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int(i) = (0); (i) < (n); (i)++) cin >> a[i];
    bool flag = true;
    for (int(i) = (1); (i) < (n); (i)++)
      if (a[i] >= a[i - 1]) flag = false;
    if (flag)
      cout << "NO"
           << "\n";
    else
      cout << "YES"
           << "\n";
  }
}
