#include using namespace std; using ll=long long; using pii=pair; #define all(a) a.begin(),a.end() #define pb push_back #define sz(a) ((int)a.size()) const int N=200005; int n,a[N]; void ahcorz(){ cin >> n; for(int i=0; i> a[i]; if(a[0]^a[n-1]){ cout << "Yes\n"; return; } for(int i=0; i=4?"Yes":"No") << "\n"; } signed main(){ ios_base::sync_with_stdio(0),cin.tie(0); int t; cin >> t; while(t--) ahcorz(); }