#include<bits/stdc++.h>
using namespace std;

int main(){
	int t;
	cin >> t;
	for(int i=0;i<t;i++){
		int n,cyc = 0, mx = 0;
		cin >> n;
		int a[n];
		for(int j=0;j<n;j++){
			cin >> a[j]; 
			if(a[j] >= mx){
				mx = a[j];
				a[j] = 0;
				cyc++;
			}
		}
		//cout << cyc << endl;
		if(cyc % 2 == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
	}
	return 0;
}