We are given an N x N letter grid where exactly one cell in each row and each column contains a letter "A" and the remaining N2-N cells contain a letter "B". We can flip a "B" to an "A" in a cell if at least two of its neighbours already contain an "A". Cells are considered to be neighbours if they share an edge.
Can you fill all N2 squares by "A"s?
First line of the input contains an integer T (1 ≤ T ≤ 10), the number of test cases. Then follow 2*T lines, where each 2 consecutive lines contain the description of one test case
For each test case, the first of the two lines contains an integer N, the size of the grid (2 ≤ N ≤ 100,000).
The second line contains a permutation of first N positive integers, indicating the columns in which "A"s are already filled, in order of rows. For example, if N = 4 and given columns are 4 2 1 3, "A"s are in cells (1,4), (2,2), (3,1) and (4,3).
For each test case, print one line with the text "yes" or "no", indicating that the grid can be filled entirely with "A"s or not.
2 2 1 2 5 1 3 5 2 4
yes no