#include <bits/stdc++.h>
int main(void) {
  int c, n, m, i, j, temp, flag = 0;
  scanf("%d", &n);
  c = n;
  while (c--) {
    j = 0;
    int num[50000] = {0};
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
      scanf("%d", &num[i]);
    }
    for (i = 1; i < m; i++) {
      if (num[i] >= num[i - 1]) j++;
    }
    if (j++)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
