You are given an array of positive integers.
First, choose an integer (1 \le k \le n). Partition the array into groups according to indices modulo : for each c = 0,1,\dots,k-1, let \text{group}_c = \{ a_i \mid i \equiv c \pmod{k} \}.
Within each group, you may repeatedly perform the following operation:
Choose two indices that belong to the same group (i \neq j).
Choose a divisor of a_i (i.e. d \mid a_i).
Replace \displaystyle a_i \leftarrow \displaystyle \frac{a_i}{d} and a_j \leftarrow a_j \cdot d.
After performing any number of operations (possibly zero), compute for each group the greatest common divisor g_c = \gcd(\text{group}_c). Collect them into a multiset M = \{ g_c \mid 0 \le c < k \}.
Your goal is to choose and apply operations so as to maximize
The first line contains a positive integer (1 \le t \le 10^4) — the number of test cases.
The first line of each test case contains only a single positive integer (1 \le n \le 2000) — the length of the array .
The second line of each test case contains separated integers a_1,a_2,..,a_n (1 \le a_i \le 10^{9}) — the array .
It's guaranteed that \sum n \le 2000 overall tests
For each test case, output on a separate line: Print the maximum that you can achieve in the multiset.
Example 1
In the first test case , choose k=2 then
\text{group}_1=\{a_1\}=\{4\}
\text{group}_2=\{a_2\}=\{20\}
and thus \min(M)=\gcd(\{4\})=4.
In the second test case , choose k=1 then \text{group}_1=\{a_1,a_2,a_3,a_4\}=\{245,8575,1715,875\} , Initially \gcd(a)=35 but it can be improved with performing operations :
Pick i=2 and j=4 with d=7 :
a_2 \leftarrow \frac{8575}{7}=1225
a_4 \leftarrow 875 \times 7=6125
Now the array becomes a=[245, 1225, 1715, 6125] and we've \gcd(a)=245 and it can be shown that's the minimum across all possible .
and thus \min(M)=\gcd(a)=245.
Subtask ( points) : (n=1).
Subtask ( points) : (a_1=a_2=a_3...=a_n).
Subtask ( points) : (\sum n \le 100) and (1 \le a_i \le 10^6).
Subtask ( points) : (1 \le a_i \le 10^6)
Subtask ( points) : (\sum n \le 1000).
Subtask ( points) : No additional constraints