#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);}) #define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) char wbuf[1<<25]; int main(){ char*wp=wbuf; rd_init(); int t=rd(); while(t--){ int n=rd(); int first=0,last=0,good=1; while(n--){ int c=*rp; rp+=2; if(!(c&1)){ if(last==c){ good=0; } last=c; if(!first){ first=c; } } } if(first==last){ good=0; } if(good){ *wp++='Y'; *wp++='e'; *wp++='s'; }else{ *wp++='N'; *wp++='o'; } *wp++='\n'; } write(1,wbuf,wp-wbuf); _exit(0); }