Anti-Arithmetic Permutation

No attempts yetTime limit1sMemory limit128 MB

Problem

A permutation p0,p1,,pn1p_0, p_1, \dots, p_{n-1} of the integers 0,1,,n10, 1, \dots, n-1 is anti-arithmetic when no three of its terms form an arithmetic series. That is, there are no three indices i<j<ki < j < k for which pi,pj,pkp_i, p_j, p_k is an arithmetic series, which happens exactly when pjpi=pkpjp_j - p_i = p_k - p_j, or equivalently pi+pk=2pjp_i + p_k = 2 p_j.

For example, 3, 1, 0, 4, 2 is an anti-arithmetic permutation of 0,1,2,3,40, 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 nn, decide whether it is anti-arithmetic.

Input

The first line contains an integer TT, the number of test cases.

Each test case consists of two lines. The first line contains an integer nn. The next line contains nn integers separated by a single space, a permutation of 0,1,,n10, 1, \dots, n-1. nn is between 3 and 50 inclusive.

Output

For each test case, print one line in the format Case #x: M, where xx is the case number starting from 1 and MM is YES when the given permutation is anti-arithmetic and NO otherwise.