#pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #define ff(i, a, b) for(int i=(a); (i <= (b)); ++i) #define FF(i, a, b) for(int i=(a); (i >= (b)); --i) #define fin( v , a ) for(auto v : a ) #define ll long long #define random(a, b) (rand() % (b - a + 1) + a) #define pi 3.141592653589793238462643383279502884 #define INRA(a,u,v) {cout << "_\n"; ff(i,u,v) cout << a[i].x << " " << a[i].y << endl; cout << "|\n";} #define pb push_back #define mp make_pair #define y1 ahsclskajlasjdkl #define x1 akjadhaskdals using namespace std; // Fast IO ******************************************************************************************************** const int __BS = 4096; static char __bur[__BS + 16], *__er = __bur + __BS, *__ir = __er; template<class T = int> T readInt() { auto c = [&]() { if (__ir == __er) std::fill(__bur, __bur + __BS, 0), cin.read(__bur, __BS), __ir = __bur; }; c(); while (*__ir && (*__ir < '0' || *__ir > '9') && *__ir != '-') ++__ir; c(); bool m = false; if (*__ir == '-') ++__ir, c(), m = true; T r = 0; while (*__ir >= '0' && *__ir <= '9') r = r * 10 + *__ir - '0', ++__ir, c(); ++__ir; return m ? -r : r; } static char __buw[__BS + 20], *__iw = __buw, *__ew = __buw + __BS; template<class T> void writeInt(T x, char endc = '\n') { if (x < 0) *__iw++ = '-', x = -x; if (x == 0) *__iw++ = '0'; char* s = __iw; while (x) { T t = x / 10; char c = x - 10 * t + '0'; *__iw++ = c; x = t; } char* f = __iw - 1; while (s < f) swap(*s, *f), ++s, --f; if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw; *__iw++ = endc; } template<class T> void writeStr(const T& str) { int i = 0; while (str[i]) { *__iw++ = str[i++]; if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw; } } struct __FL__ { ~__FL__() { if (__iw != __buw) cout.write(__buw, __iw - __buw); } }; static __FL__ __flushVar__; //******************************************************************************************************************* template<class X, class Y> void minimize(X &a, const Y &b) { a = (b<a) ? b : a; } template<class X, class Y> void maximize(X &a, const Y &b) { a = (b>a) ? b : a; } const int M = 1000000000+7; struct re { int x, y; re () {}; re (int X, int Y) {x = X; y = Y;}; /*const bool operator < (const re &a) const{ if (x!=a.x) return x<a.x; return y<a.y; }*/ }; int t, n, a[22], b[22], cnt; bool check() { ff(i, 1, n) { cnt = 0; ff(j, 1, n) if (i != j) { b[++cnt] = a[j]; } bool ok = 1; ff(j, 2, n - 1) if (b[j] < b[j - 1]) ok = 0; if (ok) return 1; } return 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); //freopen("checking.inp", "r" , stdin); //freopen("checking.out", "w", stdout); cin >> t; while (t--) { cin >> n; ff(i, 1, n) { cin >> a[i]; } if (check()) cout << "YES" << endl; else cout << "NO" << endl; } } //This code belongs to S34vv1nd :3