An arithmetic sequence is a sequence of numbers such that the difference between consecutive elements is constant. For example, the sequence 5,7,9,11,13 is an arithmetic sequence (the common difference is 2), but the sequence 1,2,4,5 is not (the differences between consecutive elements are 1, 2 and 1).
Given the set of integers a_1,a_2,…,a_n, find the size of its largest subset that forms an arithmetic sequence.
The set A is said to form an arithmetic sequence if there exists an ordering of A that is an arithmetic sequence.
The first line of input contains a single integer z, the number of test cases. The descriptions of the test cases follow.
Each test case consists of a separate line containing an integer n (1≤n≤2000) followed by n integers a_1,a_2,…,a_n (0≤a_i≤109). The numbers a_i are pairwise distinct.
For each test case, output a single line containing the size of the largest arithmetic sequence found in the given set.