#include <bits/stdc++.h> #define MOD 1000000007 #define endl "\n" typedef long long ll; using namespace std; const int N = 22; int a[N]; int n; void solve() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { int x = -1; bool ok = true; for(int j = 1; j <= n; j++) { if(i == j) continue; if(a[j] < x) { ok = false; break; } x = a[j]; } if(ok) { cout << "YES" << endl; return; } } cout << "NO" << endl; } int main() { ios::sync_with_stdio(false); cout.precision(10); int t; cin >> t; while(t--) solve(); return 0; }