There are $n$ athletes in front of you. Athletes are numbered from $1$ to $n$ from left to right. You know the strength of each athlete — the athlete number $i$ has the strength $s_i$.

You want to split all athletes into two teams. Each team must have at least one athlete, and each athlete must be exactly in one team.

You want the strongest athlete from the first team to differ as little as possible from the weakest athlete from the second team. Formally, you want to split the athletes into two teams $A$ and $B$ so that the value $|\max(A) - \min(B)|$ is as small as possible, where $\max(A)$ is the maximum strength of an athlete from team $A$, and $\min(B)$ is the minimum strength of an athlete from team $B$.

For example, if $n=5$ and the strength of the athletes is $s=[3, 1, 2, 6, 4]$, then one of the possible split into teams is:   first team: $A = [1, 2, 4]$,  second team: $B = [3, 6]$. 

In this case, the value $|\max(A) - \min(B)|$ will be equal to $|4-3|=1$. This example illustrates one of the ways of optimal split into two teams.

Print the minimum value $|\max(A) - \min(B)|$.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of test cases in the input. Then $t$ test cases follow.

Each test case consists of two lines. 

The first line contains positive integer $n$ ($2 \le n \le 50$) — number of athletes. 

The second line contains $n$ positive integers $s_1, s_2, \ldots, s_n$ ($1 \le s_i \le 1000$), where $s_i$ — is the strength of the $i$-th athlete. Please note that $s$ values may not be distinct.


-----Output-----

For each test case print one integer — the minimum value of $|\max(A) - \min(B)|$ with the optimal split of all athletes into two teams. Each of the athletes must be a member of exactly one of the two teams.


-----Example-----
Input
5
5
3 1 2 6 4
6
2 1 3 2 4 3
4
7 9 3 1
2
1 1000
3
100 150 200

Output
1
0
2
999
50



-----Note-----

The first test case was explained in the statement. In the second test case, one of the optimal splits is $A=[2, 1]$, $B=[3, 2, 4, 3]$, so the answer is $|2-2|=0$.

Difficulty: introductory

Starter code:

Solutions:

T = int(input())

for _ in range(T):
    a = int(input())
    hh = sorted(map(int, input().split()))
    ans = 10**10
    for h1, h2 in zip(hh[:-1], hh[1:]):
        ans = min(ans, h2 - h1)

    print(ans)


for u in range(int(input())):
    n=int(input())
    l=list(map(int,input().split()))
    l.sort()
    m=10**10
    for i in range(1,n):
        x=l[i]-l[i-1]
        m=min(m,x)
    print(m)


def read_int():
    return int(input())


def read_ints():
    return list(map(int, input().split(' ')))


t = read_int()
for case_num in range(t):
    n = read_int()
    a = list(read_ints())
    a.sort()
    ans = int(1e9)
    for i in range(n - 1):
        ans = min(ans, abs(a[i] - a[i + 1]))
    print(ans)


from math import *
import math

def r1(t):
    return t(input())

def r2(t):
    return [t(i) for i in input().split()]


for zzz in range(r1(int)):
    n = r1(int)
    s = r2(int)
    s.sort()
    ans = s[-1] - s[0]
    for i in range(n - 1):
        ans = min(ans, s[i + 1] - s[i])
    print(ans)


"""
Author: Q.E.D
Time: 2020-05-24 08:39:12
"""
T = int(input())
for _ in range(T):
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(a)
    ans = abs(a[0] - a[1])
    for i in range(1, n):
        ans = min(ans, abs(a[i] - a[i - 1]))
    print(ans)

from collections import deque
from sys import stdin, stdout  
input = stdin.readline
#print = stdout.write

for _ in range(int(input())):
    n = int(input())
    arr = sorted(list(map(int, input().split())))
    print(min([arr[i + 1] - arr[i] for i in range(n - 1)]))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline
 
M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]


for _ in range(val()):
    n = val()
    l = sorted(li())
    ans = float('inf')
    for i in range(1,n):
        ans = min(ans,l[i] - l[i-1])
    print(ans)

import sys
input = sys.stdin.readline

t=int(input())
for tests in range(t):
    n=int(input())
    S=sorted(map(int,input().split()))

    ANS=1<<30

    for i in range(1,n):
        ANS=min(ANS,S[i]-S[i-1])
    print(ANS)

    


T = int(input())
for t in range(T):
    N = int(input())
    strengths = list(map(int, input().split()))
    s = sorted(strengths)

    res = 100000000
    for i in range(N - 1):
        diff = s[i + 1] - s[i]
        res = min(res, diff)

    print(res)


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int,input().split()))
	l.sort()
	wynik = 23472983749823739
	for i in range(1,n):
		wynik = min(wynik, l[i]-l[i-1])
	print(wynik)

# We are evolved to search for meaning but ultimately life has none. Naval Ravikant
# by : Blue Edge - Create some chaos

for _ in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    ans=max(a)-min(a)
    for i in range(1,n):
        ans=min(a[i]-a[i-1],ans)
    print(ans)


for _ in range(int(input())):
    n = int(input())
    ar = list(map(int, input().split()))
    ar.sort()
    ans = 10000000000
    for i in  range(1, n):
        ans = min(abs(ar[i] - ar[i - 1]), ans)
    print(ans)

for i in range(int(input())):
    c = int(input())
    f = sorted([int(i) for i in input().split()])
    k = 1000000000000
    for j in range(1, c):
        k = min(k, f[j] - f[j - 1])

    print(k)


import math
from math import gcd
t = int(input())
for i in range(t):
    n = int(input())
    l=list(map(int,input().split()))
    l.sort()
    ans=1001
    for i in range(1,n):
        ans=min(ans,l[i]-l[i-1])
    print(ans)
        


t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    c = []
    a.sort()
    for i in range(n-1):
        c.append(a[i+1]-a[i])
    print(min(c))



def solve():
  #n, m = [int(i) for i in input().split(' ')]
  n = int(input())
  a = [int(i) for i in input().split(' ')]
  a.sort()
  md = 10000
  for i in range(n-1):
    md = min(a[i+1]-a[i],md)

  return md


for t in range(int(input())):
  print(solve())


t=int(input())
for i in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    b=[]
    for i in range(n-1):
        b.append(a[i+1]-a[i])
    print(min(b))