Chef likes all arrays equally. But he likes some arrays more equally than others. In particular, he loves Rainbow Arrays. 
An array is Rainbow if it has the following structure:
- First a1 elements equal 1. 
- Next a2 elements equal 2. 
- Next a3 elements equal 3. 
- Next a4 elements equal 4. 
- Next a5 elements equal 5. 
- Next a6 elements equal 6. 
- Next a7 elements equal 7. 
- Next a6 elements equal 6. 
- Next a5 elements equal 5. 
- Next a4 elements equal 4. 
- Next a3 elements equal 3. 
- Next a2 elements equal 2. 
- Next a1 elements equal 1. 
- ai can be any non-zero positive integer.
- There are no other elements in array. 

Help Chef in finding out if the given array is a Rainbow Array or not. 

-----Input-----
- The first line of the input contains an integer T denoting the number of test cases.
- The first line of each test case contains an integer N, denoting the number of elements in the given array. 
- The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of array. 

-----Output-----
- For each test case, output a line containing "yes" or "no" (without quotes) corresponding to the case if the array is rainbow array or not. 

-----Constraints-----
- 1 ≤ T ≤ 100
- 7 ≤ N ≤ 100
- 1 ≤ Ai ≤ 10

-----Subtasks-----
- Subtask 1 (100 points) : Original constraints

-----Example-----
Input
3
19
1 2 3 4 4 5 6 6 6 7 6 6 6 5 4 4 3 2 1
14
1 2 3 4 5 6 7 6 5 4 3 2 1 1
13
1 2 3 4 5 6 8 6 5 4 3 2 1

Output
yes
no
no

-----Explanation-----
The first example satisfies all the conditions. 
The second example has 1 element of value 1 at the beginning and 2 elements of value 1 at the end. 
The third one has no elements with value 7 after elements with value 6.

Difficulty: interview

Starter code:

Solutions:
t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 N=int(input())
 a=list(map(int,input().split())) 
 rev=a[::-1] 
 dup=set(a) 
 if rev== a and list(dup) ==x:    
  print("yes")
 else:
  print("no")

# cook your dish here
t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 N=int(input())
 a=list(map(int,input().split())) 
 rev=a[::-1] 
 dup=set(a) 
 if rev== a and list(dup) ==x:    
  print("yes")
 else:
  print("no")

# cook your dish here
t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 N=int(input())
 a=list(map(int,input().split())) 
 rev=a[::-1] 
 dup=set(a) 
 if rev== a and list(dup) ==x:    
  print("yes")
 else:
  print("no")

t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 N=int(input())
 a=list(map(int,input().split())) 
 rever=a[::-1] 
 dupli=set(a) 
 if rever== a and list(dupli) ==x:    
  print("yes")
 else:
  print("no")

t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 N=int(input())
 a=list(map(int,input().split())) 
 rever=a[::-1] 
 dupli=set(a) 
 if rever== a and list(dupli) ==x:    
  print("yes")
 else:
  print("no")

x=[1,2,3,4,5,6,7] #take list to check palindrome or not
for i in range(int(input())):
 n=int(input())
 li=list(map(int, input().split())) #take list
 revli=li[::-1] #reverse the list
 dupli=set(li) #remove duplicates from list to compare order of         nos.
 if(li==revli and list(dupli)==x):       #check conditions
  print("yes")
 else:
  print("no")
 
  


t=int(input())
x=[1,2,3,4,5,6,7]
for i in range(t):
 n=int(input())
 s=list(map(int,input().split()))
 l=s[::-1]
 r=set(s)
 if(s==l and list(r)==x):
  print("yes")
 else:
  print("no")

# cook your dish here
t=int(input())
x=[1,2,3,4,5,6,7]
for _ in range(t):
 n=int(input())
 s=list(map(int,input().split()))
 l=s[::-1]
 r=set(s)
 if(s==l and list(r)==x):
  print("yes")
 else:
  print("no")

for i in range(int(input())):
 r = [1, 2, 3, 4, 5, 6, 7]
 N = int(input())
 li = list(map(int, input().split()))
 x = []
 
 for j in li:
  if j not in x:
   x.append(j)
 
 if li == li[::-1] and x == r:
  print('yes')
 else:
  print('no')

# cook your dish here
t = int(input())
b=[1,2,3,4,5,6,7]
for i in range(t):
 n = int(input())
 a=list(map(int,input().split())) 
 sevenInt=[]
 revList=a[::-1]
 for j in a:
  if j not in sevenInt:
   sevenInt.append(j)
 if(sevenInt==b and a==revList):
  print('yes')
 else:
  print('no')
 


relist=[1,2,3,4,5,6,7]
t=int(input())
for i in range(t):
 a=int(input())
 list1 = list(map(int,input().split()))
 newlist=list(set(list1))
 revlist= list1[::-1]
 
 if(newlist==relist and list1==revlist):
  print("yes")
 else:
  print('no')


relist=[1,2,3,4,5,6,7]
t=int(input())
for i in range(t):
 a=int(input())
 list1 = list(map(int,input().split()))
 newlist=[]
 revlist= list1[::-1]
 for i in list1 :
  if i not in newlist :
   newlist.append(i)
 if(newlist==relist and list1==revlist):
  print("yes")
 else:
  print('no')


# cook your dish here
refList=[1,2,3,4,5,6,7]
t=int(input())
for i in range(t):
 a=int(input())
 list1=list(map(int,input().split()))[:a]
 sevenInt=[]
 revList=list1[::-1]
 for i in list1:
  if i not in sevenInt:
   sevenInt.append(i)
 if(sevenInt==refList and list1==revList):
  print('yes')
 else:
  print('no')

t=int(input())
for i in range(t):
 a=int(input())
 a1=list(map(int,input().split()))[:a]
 x=[]
 y=[1,2,3,4,5,6,7]
 z=a1[::-1]
 for i in a1:
  if i not in x:
   x.append(i)
 if(x==y and a1==z):
  print('yes')
 else:
  print('no')

# cook your dish here
for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 if 7 not in l:
  print('no')
  continue
 s=l.index(7)
 k=list(set(l[:s+1]))
 t=[i for i in range(1,8)]
 if k==t and l==l[::-1]:
  print('yes')
 else:
  print('no')

# cook your dish here
t = int(input())
for i in range(t):
 l = int(input())
 li = list(map(int, input().split()))[:l]
 a1 = []
 a2 = [1, 2, 3, 4, 5, 6, 7]
 a3 = li[::-1]
 for i in li:
  if i not in a1:
   a1.append(i)
 a1.sort()
 if a1 == a2 and li == a3:
  print('yes')
 else:
  print('no')


t = int(input())
for i in range(t):
 l = int(input())
 li = list(map(int, input().split()))[:l]
 a = []
 b = [1, 2, 3, 4, 5, 6, 7]
 c = li[::-1]
 for i in li:
  if i not in a:
   a.append(i)
 a.sort()
 if a == b and li == c:
  print('yes')
 else:
  print('no')

t = int(input())
for i in range(t):
 l = int(input())
 li = list(map(int, input().split()))[:l]
 a = []
 b = [1, 2, 3, 4, 5, 6, 7]
 c = li[::-1]
 for i in li:
  if i not in a:
   a.append(i)
 a.sort()
 if a == b and li == c:
  print('yes')
 else:
  print('no')

t = int(input())
for i in range(t):
 l = int(input())
 li = list(map(int, input().split()))[:l]
 a = []
 b = [1, 2, 3, 4, 5, 6, 7]
 for i in li:
  if i not in a:
   a.append(i)
 a.sort()
 if a == b and li == li[::-1]:
  print('yes')
 else:
  print('no')

t=int(input())
for i in range (t):
 n=int(input())
 l=list(map(int,input().split()))
 li=[]
 for j in l:
  if j not in li:
   li.append(j)
 li.sort()
 print('yes' if (li==[1,2,3,4,5,6,7] and l==l[::-1]) else 'no')


# cook your dish here
t=int(input())
for ts in range (t):
 n=int(input())
 l=list(map(int,input().split()))
 li=[]
 for i in l:
  if i not in li:
   li.append(i)
 li.sort()
 print('yes' if (li==[1,2,3,4,5,6,7] and l==l[::-1]) else 'no')

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 09:23:33 2021

@author: gourob
"""

test = int(input())

while test:
 
 flag=1
 n=int(input())
 
 elem=list(map(int,input().split()))
 
 p1,p2=0,n-1
 
 if elem[0] != 1:
  flag=0
 else:
  while p1<p2:
   if elem[p1] != elem[p2]:
    flag=0
    break
   if not (elem[p1] == elem[p1+1] or elem[p1]+1 == elem[p1+1]):
    flag=0
    break
   if elem[p1]>7:
    flag=0
    break
   p1+=1
   p2-=1
 if elem[p1] != 7:
    flag=0
 if flag==1:
  print("yes")
 else:
  print("no")
   
 test-=1





# cook your dish here
t=int(input())
for ts in range (t):
 n=int(input())
 l=list(map(int,input().split()))
 li=[]
 for i in l:
  if i not in li:
   li.append(i)
 li.sort()
 print('yes' if (li==[1,2,3,4,5,6,7] and l==l[::-1]) else 'no')

# cook your dish here
# cook your dish here
x=int(input())
for i in range (x):
 y=int(input())
 lst=list(map(int,input().split()))
 c=[]
 for j in lst:
  if j not in c:
   c.append(j)
 c.sort()
 print('yes' if (c==[1,2,3,4,5,6,7] and lst==lst[::-1]) else 'no')

# cook your dish here
t=int(input())
for _ in range (t):
 n=int(input())
 l=list(map(int,input().split()))
 c=[]
 for i in l:
  if i not in c:
   c.append(i)
 c.sort()
 print('yes' if (c==[1,2,3,4,5,6,7] and l==l[::-1]) else 'no')