#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, data[100000] = {}, flag;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    flag = 1;
    for (int j = 0; j < n; j++) {
      cin >> data[j];
    }
    for (int j = 1; j < n; j++) {
      if (data[j - 1] <= data[j]) flag = 0;
    }
    if (flag)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
