A permutation p0,p1,…,pn−1 of the integers 0,1,…,n−1 is anti-arithmetic when no three of its terms form an arithmetic series. That is, there are no three indices i<j<k for which pi,pj,pk is an arithmetic series, which happens exactly when pj−pi=pk−pj, or equivalently pi+pk=2pj.
For example, 3, 1, 0, 4, 2 is an anti-arithmetic permutation of 0,1,2,3,4. The sequence 0, 5, 4, 3, 1, 2 is not anti-arithmetic. Its first, fifth and sixth terms 0, 1, 2 form an arithmetic series, and so do its second, fourth and fifth terms 5, 3, 1 and its second, third and fourth terms 5, 4, 3.
Given a permutation of length n, decide whether it is anti-arithmetic.
The first line contains an integer T, the number of test cases.
Each test case consists of two lines. The first line contains an integer n. The next line contains n integers separated by a single space, a permutation of 0,1,…,n−1. n is between 3 and 50 inclusive.
For each test case, print one line in the format Case #x: M, where x is the case number starting from 1 and M is YES when the given permutation is anti-arithmetic and NO otherwise.