package codechef;
import java.util.*;
public class Codechef {
public static void main(String[] args) {
int f=0,i,j,k,l;
Scanner sn=new Scanner(System.in);
int s=sn.nextInt();
String q[];
q=new String[s];
for(j=1;j<=s;j++)
{
int n=sn.nextInt();
int a[]=new int[n];
for(k=0;k<n;k++)
a[k]=sn.nextInt();
for(i=0;i<n-1;i++)
{
if(n%2==0)
{
f=1;break;
}
if(i<(n-1)/2)
{
if(a[0]!=1 || (a[i]-a[i+1])!=-1)
{f=1;break;}
}
if(i>(n-1)/2)
{
if((a[i]-a[i+1])!=1)
{f=1;break;}
}
}
if(f==0)
q[j-1]="yes";
else
q[j-1]="no";
}
for(l=0;l<s;l++)
System.out.println(q[l]);
}
}