The snakes want to build a temple for Lord Cobra. There are multiple strips of land that they are looking at, but not all of them are suitable. They need the strip of land to resemble a coiled Cobra. You need to find out which strips do so.
Formally, every strip of land, has a length. Suppose the length of the i-th strip is is Ni, then there will be Ni integers, Hi1, Hi2, .. HiNi, which represent the heights of the ground at various parts of the strip, in sequential order. That is, the strip has been divided into Ni parts and the height of each part is given. This strip is valid, if and only if all these conditions are satisfied:
- There should be an unique 'centre' part. This is where the actual temple will be built. By centre, we mean that there should be an equal number of parts to the left of this part, and to the right of this part.
- Hi1 = 1
- The heights keep increasing by exactly 1, as you move from the leftmost part, to the centre part.
- The heights should keep decreasing by exactly 1, as you move from the centre part to the rightmost part. Note that this means that HiNi should also be 1.
Your job is to look at every strip and find if it's valid or not.

-----Input-----
- The first line contains a single integer, S, which is the number of strips you need to look at. The description of each of the S strips follows
- The first line of the i-th strip's description will contain a single integer: Ni, which is the length and number of parts into which it has been divided.
- The next line contains Ni integers: Hi1, Hi2, .., HiNi. These represent the heights of the various parts in the i-th strip.

-----Output-----
- For each strip, in a new line, output "yes" if is a valid strip, and "no", if it isn't.

-----Constraints-----
- 1 ≤ S ≤ 100 
- 3 ≤ Ni ≤ 100 
- 1 ≤ Hij ≤ 100 

-----Example-----
Input:
7
5
1 2 3 2 1
7
2 3 4 5 4 3 2
5
1 2 3 4 3
5
1 3 5 3 1
7
1 2 3 4 3 2 1
4
1 2 3 2
4
1 2 2 1

Output:
yes
no
no
no
yes
no
no

-----Explanation-----
In the first strip, all the conditions are satisfied, hence it is valid.
In the second strip, it does not start with a 1, and hence is invalid.
In the third strip, it keeps increasing even past the centre, instead of decreasing. Hence invalid.
The fourth strip does not increase and decrease by exactly 1. Hence invalid.
The fifth satisfies all conditions and hence is valid.
The sixth and seventh strip do not have a 'centre' part. Because for every part, there are either more parts to its right than its left, or more parts on its left than its right. Hence both the strips are invalid.

Starter code:

Solutions:
# cook your dish here
for i in range(int(input())):
 N=int(input())
 L=list(map(int,input().split()))
 l,h=0,N-1 
 flag=1
 if L[l]!=1 and L[h]!=1:
  flag=0
 else:
  while(l<h):
   if (L[l]!=L[h]) or (L[l+1]-L[l]!=1 and L[h-1]-L[h]!=1):
    flag=0
    break
   l+=1 
   h-=1
 if flag:
  print("yes")
 else:
  print("no")

# cook your dish here
for i in range(int(input())):
 N=int(input())
 L=list(map(int,input().split()))
 l,h=0,N-1 
 flag=1
 if L[l]!=1 and L[h]!=1:
  flag=0
 else:
  while(l<h):
   if (L[l]!=L[h]) or (L[l+1]-L[l]!=1 and L[h-1]-L[h]!=1):
    flag=0
    break
   l+=1 
   h-=1
 if flag:
  print("yes")
 else:
  print("no")

# cook your dish here
try:
 for i in range(int(input())):
  n=int(input())
  l=list(map(int,input().strip().split()))
  if(len(l)%2==0):
   print("no")
  else:
   if(l[0]!=1):
    print("no")
   else:
    for i in range(n//2):
     if(l[i]!=l[n-i-1]):
      print("no")
      break
     elif(l[i]-l[i+1]!=-1):
      print("no")
      break
    else:
     print("yes")
      
except:
 pass


try:
 for z in range(int(input())):
  n = int(input())
  H = [int(e) for e in input().split()]
  if n%2 == 0:
   print("no")
   
   
   
  else:
   if H[0] != 1:
    print("no")
   else:
    
    
    f = 0
    for i in range(n//2):
     if H[i] != H[n-i-1]:
      f = 1
      break
    if f == 0:
     for i in range(n//2):
      if H[i] - H[i+1] != -1:
       f = 1
       break
    if f == 1:
     print("no")
    else:
     print("yes")
except:
 pass

# cook your dish here
for i in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 if n%2==0:
  print("no")
 elif l[0]!=1 or l[-1]!=1:
  print("no")
 else:
  l1=list(range(1,(n//2)+2))
  l2=list(range(n//2,0,-1))
  if l[0:(n//2)+1]==l1 and l[n//2+1:]==l2:
   print("yes")
  else:
   print("no")

def check_strip(num, strip):
 if(num%2==0):
  return False
 elif(strip[0]!=1):
  return False
 elif(sum(strip)!=(((num//2)+1)**2)):
  return False
 else: 
  return True

try:
 for i in range(int(input())):
  num = int(input())
  strip = list(map(int, input().split()))
  if(check_strip(num, strip)):
   print('yes')
  else:
   print('no')
except Exception as e:
 print(e)

for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 if(n%2==0):
  print('no')
 else:
  t=1
  flag=0
  for i in range(0,n//2+1):
   if(x[i]==x[n-i-1]==t):
    t=t+1
   else:
    flag=1
    break
  if(flag==0):
   print('yes')
  else:
   print('no')

for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 if(n%2==0):
  print('no')
 else:
  t=1
  flag=0
  for i in range(0,n//2+1):
   if(x[i]==x[n-i-1]==t):
    t=t+1
   else:
    flag=1
    break
  if(flag==0):
   print('yes')
  else:
   print('no')

t = int(input())
for i in range(t):
 n = int(input())
 a = list(map(int, input().split()))
 valid= False
 if n%2==1 and a[0]==1:
  for j in range(int((n-1)/2)):
   if a[j]==a[n-1-j]:
    valid=True
   if a[j] +1 != a[j+1]:
    valid=False
   if a[n-1-j] != a[n-2-j] - 1:
    valid = False
 if(valid):
  print('yes')
 else:
  print('no')

# cook your dish here
for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 if(n%2==0):
  print('no')
 else:
  t=1
  pulkit=0
  for i in range(0,n//2+1):
   if(x[i]==x[n-i-1]==t):
    t=t+1
   else:
    pulkit=1
    break
  if(pulkit==0):
   print('yes')
  else:
   print('no')

# cook your dish here
t = int(input())
for z in range(t) :
 n = int(input())
 a = [int(x) for x in input().split()]
 if n%2==1 and a[0]==1 :
  x = list(reversed(a))
  for i in range((len(a)-1)//2) :
   if a[i] + 1 == x[i+1] :
    c = 0
   else:
    c = 1 
    break
  if c==1 :
   print("no")
  else:
   print("yes")
 else:
  print("no")

for _ in range(int(input())):
 n=int(input())
 x=list(map(int,input().split()))
 if(n%2==0):
  print('no')
 else:
  t=1
  flag=0
  for i in range(0,n//2+1):
   if(x[i]==x[n-i-1]==t):
    t=t+1
   else:
    flag=1
    break
  if(flag==0):
   print('yes')
  else:
   print('no')

for _ in range(int(input())):
 n= int(input())
 a= list(map(int, input().split()))
 if(n % 2)==1 and a[0] == 1:
  arr1 = list(reversed(a))
  for i in range(((len(a) - 1)//2)):
   if a[i]+1 == arr1[i+1]:
    f= 0
   else:
    f = 1
    print('no')
    break
  if f==0:
   print('yes')
 else:
  print('no')

# cook your dish here
for _ in range(int(input())):
 n= int(input())
 a= list(map(int, input().split()))
 if(n % 2)==1 and a[0] == 1:
  arr1 = list(reversed(a))
  for i in range(((len(a) - 1)//2)):
   if a[i]+1 == arr1[i+1]:
    f= 0
   else:
    f = 1
    print('no')
    break
  if f==0:
   print('yes')
 else:
  print('no')

test_cases = int(input())

def canMakeTemple(strips, strips_height):
 check = "yes"
 if (strips % 2 != 0) and (strips_height[strips//2] == (strips // 2) +1):
  left, right = 0, strips - 1
  for i in range(strips // 2):
   if strips_height[i] != strips_height[strips - i - 1]:
    check = "no"
    break 
 else:
  check = "no"
 return check


for i in range(test_cases):
 strips = int(input())
 strips_height = list(map(int, input().split()))

 print(canMakeTemple(strips, strips_height))


# cook your dish here
for _ in range(int(input())):
 num = int(input())
 arr = list(map(int, input().split()))
 if(num % 2)==1 and arr[0] == 1:
  arr1 = list(reversed(arr))
  for i in range(((len(arr) - 1)//2)):
   if arr[i]+1 == arr1[i+1]:
    flag = 0
   else:
    flag = 1
    print('no')
    break
  if flag == 0:
   print('yes')
 else:
  print('no')

for i in range(int(input())):
 n=int(input())
 m=list(map(int,input().split()))
 if m[0]==1 and m[-1]==1 and n%2!=0 and m[n//2]==max(m):
  for i in range(n//2):
   if abs(m[i+1]-m[i])!=1:
    print("no")
    break
  else:
   print("yes")
 else:
  print("no")
 


# cook your dish here
for _ in range(int(input())):
 n = int(input())
 l = list(map(int,input().split()))
 f = True
 for i in range((n+1)//2):
  if l[i] != i+1:
   f = False
  if l[n-i-1] != i+1:
   f = False
 if n%2 == 0:
  f = False
 if f == True:
  print("yes")
 else:
  print("no")


num=[x for x in range(1,101)]
#print(num)
for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 if n%2!=0:
  c=n//2
  if l[0]==1 and l[-1]==1:
   d=0
   for i in range(1,c+1):
    if l[i]-l[i-1]==1:
     d=d+1
   for i in range(c,n-1):
    if l[i]-l[i+1]==1:
     d=d+1
   if d==n-1:
    print("yes")
   else:
    print("no")
  else:
   print("no")
 else:
  print("no")

# cook your dish here
for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 if l[0]==1 and l[-1]==1 and n%2!=0 and l[n//2]==max(l):
  for i in range(n//2):
   if abs(l[i+1]-l[i])!=1:
    print("no")
    break
  else:
   print("yes")
 else:
  print("no")
 
  
 
   
  


# cook your dish here
s=int(input());
for i in range(s):
 n=int(input());
 h=list(map(int,input().split()));
 d=0;
 if n%2!=0:
  c=n//2;
  if h[0]==1:
   for i in range(1,c+1):
    if h[i]-h[i-1]==1:
     d=d+1;
   for i in range(c,len(h)-1):
    if h[i]-h[i+1]==1:
     d=d+1;
   #print(d);
   if d==n-1:
    print('yes');
   else:
    print('no');
  else:
   print('no');
 else:
  print('no');
    
  


T=int(input())
for i in range(T):
 N=int(input())
 H=list(map(int,input().split()))[:N]
 if N%2!=0 and H[0]==1 and H[N//2]==max(H) and H[-1]==1:
  for j in range(len(H)-1):
   if abs(H[j+1]-H[j])!=1:
    print("no")
    break
  else:
   print("yes")
 else:
  print("no")
  


# cook your dish here
s=int(input());
for i in range(s):
 n=int(input());
 h=list(map(int,input().split()));
 d=0;
 if n%2!=0:
  c=n//2;
  if h[0]==1:
   for i in range(1,c+1):
    if h[i]-h[i-1]==1:
     d=d+1;
   for i in range(c,len(h)-1):
    if h[i]-h[i+1]==1:
     d=d+1;
   #print(d);
   if d==n-1:
    print('yes');
   else:
    print('no');
  else:
   print('no');
 else:
  print('no');
    
  
 
     
     
   
    


T=int(input())
for i in range(T):
 N=int(input())
 H=list(map(int,input().split()))[:N]
 if N%2!=0 and H[0]==1 and H[N//2]==max(H) and H[-1]==1:
  for j in range(len(H)-1):
   if abs(H[j+1]-H[j])!=1:
    print("no")
    break
  else:
   print("yes")
 else:
  print("no")