#include <bits/stdc++.h>   inline int rd(int f = 1, int x = 0, char ch =    ) {     while (!isdigit(ch = getchar()))       if (ch ==  - ) f = -1;     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return f * x;   }   const int N = 1e5 + 5;   int n, a[N], ans;   int main() {     for (int T = rd(); T--;) {       n = rd(), ans = 0;       for (int i = 1; i <= n; ++i) a[i] = rd();       for (int i = 2; i <= n; ++i) ans |= a[i - 1] <= a[i];       puts(ans ?  YES  :  NO );     }     return 0;   }   