Given an integer array A=[a1,a2,…,an] of length nn, you need to determine if there exists an integer array B=[b_1,b_2,\dots,b_n]B=[b1,b2,…,bn] such that the followings hold:
A sequence C=[c1,c2,…,ck] is called an arithmetic subsequence of BB if and only if the followings are satisfied:
The first line contains an integer T 1≤T≤25), denoting the number of test cases.
For each test case, the first line contains an integer n(1≤n≤5000), denoting the size of the array AA.
The next line contains nn integers a1,a2,…,an(1≤ai≤109), denoting the elements of the array AA.
2
4
3 6 8 9
5
1 1 1 1 1
YES
8 6 9 3
NO