Chef and Rainbow Array

All submissions for this problem are available.
Read problems statements in mandarin chinese, russian and vietnamese as well.
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 a_{1} elements equal 1.
 Next a_{2} elements equal 2.
 Next a_{3} elements equal 3.
 Next a_{4} elements equal 4.
 Next a_{5} elements equal 5.
 Next a_{6} elements equal 6.
 Next a_{7} elements equal 7.
 Next a_{6} elements equal 6.
 Next a_{5} elements equal 5.
 Next a_{4} elements equal 4.
 Next a_{3} elements equal 3.
 Next a_{2} elements equal 2.
 Next a_{1} elements equal 1.
 a_{i} can be any nonzero 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 spaceseparated integers A_{1}, A_{2}, ..., A_{N} 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 ≤ A_{i} ≤ 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.
Author:  berezin 
Editorial  https://discuss.codechef.com/problems/RAINBOWA 
Tags  adhoc, aug17, berezin, cakewalk, implementation 
Date Added:  15032014 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions