You are given a sequence a1, a2, ..., aN. Find the smallest possible value of ai + aj, 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 - a1, a2, ..., aN 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 = 105, N = 2 : 13 points.
- T = 105, 2 ≤ N ≤ 10 : 16 points.
- T = 1000, 2 ≤ N ≤ 100 : 31 points.
- T = 10, 2 ≤ N ≤ 105 : 40 points.
- 1 ≤ ai ≤ 106

-----Example-----
Input:
1
4
5 1 3 4

Output:
4

-----Explanation-----
Here we pick a2 and a3. Their sum equals to 1 + 3 = 4.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
def __starting_point():
 try:
  for _ in range (int(input())):
   element = int(input())
   l = list(map(int,input().split()))
   a=min(l)
   l.remove(a)
   b=min(l)
   print(a+b)
 except EOFError :
  print('EOFError')

__starting_point()

for _ in range(int(input())):
 n=int(input())
 l=list(map(int,input().split()))
 l.sort()
 print(l[0]+l[1])
  
  



# cook your dish here
t = int(input())
for i in range(t):
 n = int(input())
 l = list(map(int,input().split()))
 l.sort()
 print(l[0] + l[1])


# cook your dish here
try:
 for t in range(int(input())):
  n = int(input())
  a = list(map(int, input().split(' ')))
  s = min(a)
  a.remove(s)
  ss = min(a)
  print(s + ss)
except:
 pass

# cook your dish here
try:
 for t in range(int(input())):
  n = int(input())
  a = list(map(int, input().split(' ')))
  small = min(a)
  a.remove(small)
  small1 = min(a)
  print(small + small1)
except: pass

# cook your dish here
n = int(input())
for i in range(n):
 num = int(input())
 lis = list(map(int,input().split()))
 mini = min(lis)
 lis.remove(mini)
 mini2 = min(lis)
 print(mini + mini2)

# cook your dish here
try:    
 for i in range(int(input())):
  val = int(input())
  arr=list(map(int,input().split()))
  arr.sort()
  print(arr[0]+arr[1])
except:
 pass

# cook your dish here
for _ in range(int(input())):
 n=int(input())
 s=list(map(int,input().split()))
 k=0
 for i in range(2):
  k+=min(s)
  s.remove(min(s))
 print(k) 

for _ in range(int(input())):
 n=int(input())
 s=list(map(int,input().split()))
 k=0
 for i in range(2):
  k+=min(s)
  s.remove(min(s))
 print(k) 
  


# https://www.codechef.com/problems/SMPAIR

T = int(input())

for t in range(T):
 N = int(input())
 A = [int(x) for x in input().split()]
 m = A[0] + A[1]
 for i in range(N):
  for j in range(i + 1, N):
   cur = A[i] + A[j]
   if cur < m:
    m = cur
 print(m)


for _ in range(int(input())):
 n = int(input())
 l = [int(n) for n in input().split()]
 a = min(l)
 l.remove(a)
 b = min(l)
 print(a+b)

for i in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))[:n]
 a.sort()
 print(a[0]+a[1])

for i in range(int(input())):
 n=int(input())
 lis=list(map(int,input().split()))
 lis.sort()
 print(lis[0]+lis[1])


# cook your dish here
t=int(input())
for i in range(t):
 n=int(input())
 l=list(map(int,input().split()))
 l.sort()
 print(l[0]+l[1])

# cook your dish here
t=int(input())
for i in range(t):
 n=int(input())
 l=list(map(int,input().split()))
 l.sort()
 print(l[0]+l[1])


n=int(input())
for i in range(n):
 t = int(input())
 l=list(map(int,input().split()))
 l.sort()
 print(l[0]+l[1])

# cook your dish here
for t in range(int(input())):
 n = int(input())
 a = list(map(int,input().split()))
 a.sort()
 print(a[0]+a[1])

for t in range (int(input())):
 n= int(input())
 a=list(map(int,input().split()))
 a.sort()
 print(a[0]+a[1])
 


for t in range(int(input())):
 n = int(input())
 a = list(map(int,input().split()))
 a.sort()
 print(a[0]+a[1])

def smallest(lst, n):
 if n == 2:
  print(lst[0] + lst[1])

 else:
  reslst = []
  mini = lst[0] + lst[1]
  for j in lst:
   for k in lst:
    if lst.index(j) == lst.index(k):
     continue
    s = j + k
    reslst.append(s)

  print(min(reslst))


def __starting_point():
 t = int(input())
 for i in range(t):
  n = int(input())
  arr = [int(i) for i in input().split()]
  smallest(arr, n)
__starting_point()

def smallest(lst, n):
 if n == 2:
  print(lst[0] + lst[1])

 else:
  mini = lst[0] + lst[1]
  for j in range(1, n):
   for k in range(j+1, n):
    s = lst[j] + lst[k]
    if s < mini:
     mini = s

  print(mini)


def __starting_point():
 t = int(input())
 for i in range(t):
  n = int(input())
  arr = [int(i) for i in input().split()]
  smallest(arr, n)

__starting_point()

def smallest(lst, n):
 if n == 2:
  print(lst[0] + lst[1])
  
 elif 2 < n <= 10:
  mini = lst[0] + lst[1]
  for j in range(2, n):
   suM = lst[j-1] + lst[j]
   if suM < mini:
    mini = suM
  print(mini)


def __starting_point():
 t = int(input())
 for i in range(t):
  n = int(input())
  arr = [int(i) for i in input().split()]
  smallest(arr, n)

__starting_point()

def smallest(lst, n):
 if n == 2:
  mini = lst[0] + lst[1]
 else:
  mini = lst[0] + lst[1]
  for j in range(2, n):
   suM = lst[j-1] + lst[j]
   if suM < mini:
    mini = suM
 print(mini)


def __starting_point():
 t = int(input())
 for i in range(t):
  n = int(input())
  arr = [int(i) for i in input().split()]
  smallest(arr, n)

__starting_point()