#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    int arr[n];
    for (int i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
    }
    bool can = false;
    for (int i = 1; i < n; i++) {
      if (arr[i] >= arr[i - 1]) {
        can = true;
        break;
      }
    }
    if (can) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
