Problem7299--CodeChef SMPAIR - The Smallest Pair

7299: CodeChef SMPAIR - The Smallest Pair

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

You are given a sequence $a_1, a_2, ..., a_N$. Find the smallest possible value of $a_i + a_j$, where 1 ≤ i < j ≤ N.

Input

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. 
The first line of each description consists of a single integer N.
The second line of each description contains N space separated integers - $a_1, a_2, ..., a_N$ respectively.

Output

For each test case, output a single line containing a single integer - the smallest possible sum for the corresponding test case.

Constraints

T = $10^5$, N = 2 : 13 points.
T = $10^5$, 2 ≤ N ≤ 10 : 16 points.
T = 1000, 2 ≤ N ≤ 100 : 31 points.
T = 10, 2 ≤ N ≤ $10^5$ : 40 points.
$1 ≤ a_i ≤ 10^6$

Sample 1 Input

1
4
5 1 3 4

Sample 1 Output

4
Here we pick $a_2$ and $a_3$. Their sum equals to 1 + 3 = 4.

HINT

难度分:1352
题目来源:CodeChef SMPAIR

Source/Category