import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int total= Integer.parseInt(scan.nextLine());
if(total<1||total>100)
{
System.exit(0);
}
int temp=0;
String fresult[] = new String[total];
for(int val = 1; val<=total; val++)
{
int ne = Integer.parseInt(scan.nextLine());
if(ne < 7 || ne > 100)
{
System.exit(0);
}
// GETING INPUT
int arr[] = new int[ne];
String sarr[]=new String[ne];
sarr=scan.nextLine().split(" ");
for (int i = 0; i < ne; ++i)
{
arr[i] = Integer.parseInt(sarr[i]);
if(arr[i]<1 || arr[i]>10)
System.exit(0);
}
// CHECKING THE CONDITIONS
// Condition 1
int midval=ne/2,count=0;
for(int i = 0; i < midval ; i++)
{
int length = arr.length - 1 - i;
if( arr[length] == arr[i])
{
count++;
}
}
// Condition 2
int temp1 = arr[midval-1]+1;
int temp2 = arr[midval];
// STORING RESULT
if(ne%2==0)
{
if(count == midval)
fresult[temp++]="yes";
else
fresult[temp++]="no";
}
else
{
if( (count == midval) && (temp1 == temp2))
fresult[temp++]="yes";
else
fresult[temp++]="no";
}
}
//PRINTING RESULT
for (String fresult1 : fresult)
{
System.out.println(fresult1);
}
}
}