#include <bits/stdc++.h>
void swap(long *a, long *b) {
  long c;
  c = *a;
  *a = *b;
  *b = c;
}
long a[500001] = {0};
int main() {
  long i, j, o;
  long n, m, flag;
  scanf("%ld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%ld", &m);
    flag = 0;
    for (j = 1; j <= m; j++) {
      scanf("%ld", &a[j]);
      if (j > 1)
        if (a[j] >= a[j - 1]) flag = 1;
    }
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
