import java.util.*;
class RAINBOW {
public static void main(String []args){
try{
Scanner in=new Scanner(System.in);
int T=in.nextInt();
for(int g=0;g<T;g++){
int N=in.nextInt();
int op=0,t=0,l=0;
int[] A=new int[N];
int[] num={1,2,3,4,5,6,7};
for(int a=0;a<N;a++){
A[a]=in.nextInt();
}
if(N%2==0){
if(A[N/2]==7)
op=0;
else op++;
}
else {
if(A[(N+1)/2]==7)
op=0;
else op++;
}
for(int x=0;x<N;x++){
if((A[x]==8)||(A[x]==9)||(A[x]==10))
t++;
}
if(t!=0){op++;}
for(int i=0;i<N/2;i++){
if((A[i+1]-A[i])!=0 || (A[i+1]-A[i])!=1)
op=0;
else op++;
}
for(int k=0;k<N/2;k++){
if((A[k]<A[k+1]) || (A[k]==A[k+1]))
l++;
if(l==0)
op++;
}
for(int w=0;w<N/2;w++){
if((A[w]!=A[N-1-w]))
op++;
}
if(op==0)
System.out.println("yes");
else System.out.println("no");
}
}catch(Exception e){return;}
}}