#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> vols(n);
    for (auto &x : vols) cin >> x;
    bool flag = 1;
    for (int i = 1; i < n; i++) {
      if (vols[i] >= vols[i - 1]) {
        flag = 0;
        break;
      }
    }
    if (flag == 1)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
