import java.util.Scanner;
/**
*
-
@author HP
*/
class Main {/**
-
@param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc =new Scanner(System.in);
int T,N;
int[][] a;
while(true){
//System.out.println(“Enter the No of Test Cases:”);T =sc.nextInt(); if(T>=1&&T<=100){ a = new int[T][]; break; }
}
for(int i=0;i<T;i++){
while(true){
// System.out.println(“Enter the no of elements in the given array”);
N=sc.nextInt();
if(N>=7&&N<=100){
break;
}
}
a[i]=new int[N];
// System.out.println(“Enter the array”);
for(int j=0;j<N;j++){
while(true){
// System.out.println(“Enter the no of elements in the given array”);
a[i][j]=sc.nextInt();
if(a[i][j]>=1&&a[i][j]<=10){
break;
}
}//if(a[i][j]<1||a[i][j]>10) // j--; }
}
int j,k;
int count=1;
int flag=0;
for(int i=0;i<T;i++){
j=0;
k=a[i].length-1;count=1;
while(j<=k){ if(j!=0){ if(a[i][j]!=a[i][j-1]) count++; } if((a[i][j]==a[i][k])&&(count==a[i][j])){ j++; k--; } else //if ((a[i][j]==a[i][j+1]+1)||(a[i][j]==a[i][j+1])) { break; } /// else{ // System.out.println("no"); // break; //} } if(j>k){ System.out.println("yes"); } else{ //System.out.println("j="+j+": k="+k); System.out.println("no"); }
}
}
}
-