#include <stdio.h>
int main()
{
int t;
//printf(“Enter no of Test Cases: “);
scanf(”%d”,&t);
while(t–)
{
int n,i,j,c=0;
// printf("Enter Array Size:");
scanf("%d",&n);
int a[n];
// printf("\nEnter array elements");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0,j=n-1;i<n/2,j>n/2;--j,++i)
{
if(a[i]<1 || a[j]>7 || a[n/2]<1 || a[n/2]>7)
{
c=1;
printf("no\n");
break;
}
if(a[i]!=a[j] || a[i]>a[i+1] || a[j]>a[j-1])
{
// printf("Error");
c=1;
printf("no\n");
break;
}
if(a[i+1]-a[i]!=0 && a[i+1]-a[i]!=1)
{
c=1;
printf("no\n");
break;
}
if(a[j-1]-a[j]!=0 && a[j-1]-a[j]!=1)
{
c=1;
printf("no\n");
break;
}
}
if(c==0)
printf("yes\n");
}
return 0;
}