#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
int an[110000];
int main() {
  int z;
  int n, m;
  int i, j, k;
  int l, r;
  int u, v, w;
  int a, b, c, d;
  int x, y;
  int t, tmp;
  cin >> z;
  while (z--) {
    scanf("%d", &n);
    bool bl = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &an[i]);
    }
    for (i = 1; i < n; i++) {
      if (an[i] >= an[i - 1]) {
        bl = 1;
        break;
      }
    }
    cout << (bl ? "YES" : "NO") << endl;
  }
  return 0;
}
