#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;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglpbnQgdDsKCWNpbiA+PiB0OwoJZm9yKGludCBpPTA7aTx0O2krKyl7CgkJaW50IG4sY3ljID0gMCwgbXggPSAwOwoJCWNpbiA+PiBuOwoJCWludCBhW25dOwoJCWZvcihpbnQgaj0wO2o8bjtqKyspewoJCQljaW4gPj4gYVtqXTsgCgkJCWlmKGFbal0gPj0gbXgpewoJCQkJbXggPSBhW2pdOwoJCQkJYVtqXSA9IDA7CgkJCQljeWMrKzsKCQkJfQoJCX0KCQkvL2NvdXQgPDwgY3ljIDw8IGVuZGw7CgkJaWYoY3ljICUgMiA9PSAwKSB7CiAgICAgICAgICAgIGNvdXQgPDwgIllFUyIgPDwgZW5kbDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb3V0IDw8ICJOTyIgPDwgZW5kbDsKICAgICAgICB9Cgl9CglyZXR1cm4gMDsKfQ==