Arithmetic Sequences

아직 제출이 없습니다시간 제한1.5초메모리 제한512 MB

문제

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,135, 7, 9, 11, 13 is an arithmetic sequence (the common difference is 22), but the sequence 1,2,4,51, 2, 4, 5 is not (the differences between consecutive elements are 11, 22 and 11).

Given the set of integers a_1,a_2,,a_n\\{a\_1, a\_2, \ldots, a\_n\\}, find the size of its largest subset that forms an arithmetic sequence.

The set AA is said to form an arithmetic sequence if there exists an ordering of AA that is an arithmetic sequence.

입력

The first line of input contains a single integer zz, the number of test cases. The descriptions of the test cases follow.

Each test case consists of a separate line containing an integer nn (1n20001 \leq n \leq 2000) followed by nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i1090 \leq a\_i \leq 10^9). The numbers a_ia\_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.