ll@T;rep(T){ll@N,@A[5N];wt(AND[i,0,N](A[5*i]==A[5*i+2]!=A[5*i+1]==A[5*i+3]==A[5*i+4])?"Yes":"No");}