Chef is very fond of horses. He enjoys watching them race. As expected, he has a stable full of horses. He, along with his friends, goes to his stable during the weekends to watch a few of these horses race. Chef wants his friends to enjoy the race and so he wants the race to be close. This can happen only if the horses are comparable on their skill i.e. the difference in their skills is less.
There are N horses in the stable. The skill of the horse i is represented by an integer S[i]. The Chef needs to pick 2 horses for the race such that the difference in their skills is minimum. This way, he would be able to host a very interesting race. Your task is to help him do this and report the minimum difference that is possible between 2 horses in the race.

-----Input:-----
First line of the input file contains a single integer T, the number of test cases.

Every test case starts with a line containing the integer N.

The next line contains N space separated integers where the i-th integer is S[i].

-----Output:-----
For each test case, output a single line containing the minimum difference that is possible.

-----Constraints:-----
1 ≤ T ≤ 10
2 ≤ N ≤ 5000
1 ≤ S[i] ≤ 1000000000

-----Example:-----Input:
1
5
4 9 1 32 13

Output:
3

Explanation: The minimum difference can be achieved if we pick horses with skills 1 and 4 for the race.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
t = eval(input())
for q in range(t):
	l = eval(input())
	a = input().split()
	a = [int(x) for x in a]
	a = sorted(a)
	for i in range(l - 1):
		a[i] = a[i + 1] - a[i]
	print(min(a[0:l - 1]))


def main():
	t = int(input())
	for tt in range(0, t):
		totnums = int(input())
		nums = input()
		nnn = list(map(int, list(nums.split(' '))))
		nnn.sort()
		diff = 1000000005
		for i in range(0, len(nnn) - 1):
			if nnn[i + 1] - nnn[i] < diff:
				diff = nnn[i + 1] - nnn[i]
		print(diff)

def __starting_point():
	main()
__starting_point()


T = int(input())
for t in range(T):
	N = int(input())
	S1 = input().split()
	S = list(range(N))
	for i in range(N):
		S[i] = int(S1[i])
	S.sort()
	diff = list(range(N - 1))
	for i in range(N - 1):
		diff[i] = abs(S[i] - S[i + 1])
	print(min(diff))


import sys
t = int(input())
while t:
	t = t - 1
	min = 1000000000 + 100
	n = int(input())
	d = []
	for i in input().split():
		d.append(int(i))
	d = sorted(d)
	for i in range(1, n):
		if d[i] - d[i - 1] < min:
			min = d[i] - d[i - 1]
			if min == 0:
				break
	print(min)


N = int(input())
for i in range(0, N):
	a = int(input())
	l = []
	n = input()
	l = n.split()
	for x in range(0, len(l)):
		l[x] = int(l[x])
	l.sort()
	min = 1000000000
	for x in range(1, len(l)):
		s = int(l[x]) - int(l[x - 1])
		if min > abs(s):
			min = s
	print(str(min))


T = int(input())
line_flag = 0
out = ''
for t in range(2 * T):
	if line_flag == 0:
		N = int(input())
		line_flag = 1
	elif line_flag == 1:
		S = input().split()
		for i in range(len(S)):
			S[i] = int(S[i])
		S.sort()
		min_array = []
		for i in range(len(S) - 1):
			min_array.append(abs(S[i + 1] - S[i]))
		out += str(min(min_array)) + '\n'
		line_flag = 0
print(out[:-1])


t = eval(input())
while t > 0:
	t -= 1
	n = eval(input())
	str = input()
	inp = str.split()
	inp = list(map(int, inp))
	inp.sort()
	smallest = abs(inp[0] - inp[1])
	for i in range(1, n - 1):
		temp = abs(inp[i] - inp[i + 1])
		if temp < smallest:
			smallest = temp
	print(smallest)


NAME = 'P5'
try:
	inFile = open(NAME + '.txt')
except:
	pass

def read():
	try:
		return inFile.readline().strip()
	except:
		return input().strip()
cases = int(read())
for _ in range(cases):
	n = int(read())
	skill = list(map(int, read().split()))
	skill.sort()
	best = 1000000000
	for i in range(1, len(skill)):
		best = min(best, skill[i] - skill[i - 1])
	print(best)


t = eval(input())
for i in range(0, t):
	a = []
	n = eval(input())
	a = input().split()
	for j in range(0, n):
		a[j] = int(a[j])
	a.sort()
	m = 10000000000
	for j in range(0, n - 1):
		if a[j + 1] - a[j] < m:
			m = a[j + 1] - a[j]
	print(m)


T = eval(input())

def solve(A):
	A.sort()
	best = 10000000000
	for i in range(len(A) - 1):
		diff = abs(A[i] - A[i + 1])
		if diff < best:
			best = diff
	return best
for i in range(T):
	N = eval(input())
	A = list(map(int, input().split()))
	print(solve(A))


def solve():
	input()
	s = sorted(map(int, input().split()))
	print(min((s[i + 1] - s[i] for i in range(len(s) - 1))))
for i in range(int(input())):
	solve()


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


MAX = 10000000000

def main():
	t = int(input())
	j = 0
	min = []
	while j < t:
		N = int(input())
		i = 0
		S = list(map(int, input().split()))
		S.sort()
		min.append(MAX)
		while i < N - 1:
			if S[i + 1] - S[i] < min[j]:
				min[j] = S[i + 1] - S[i]
			i = i + 1
		j = j + 1
	j = 0
	while j < t:
		print(min[j])
		j = j + 1

def __starting_point():
	main()
__starting_point()


test_cases = int(input())
for i in range(test_cases):
	no = int(input())
	skill = input().split()
	for j in range(no):
		skill[j] = int(skill[j])
	skill.sort()
	min = skill[no - 1]
	for j in range(no - 1):
		if skill[j + 1] - skill[j] < min:
			min = skill[j + 1] - skill[j]
	print(min)


T = eval(input())
for i in range(T):
	N = eval(input())
	inp = input().split()
	linp = []
	for item in inp:
		linp.append(int(item))
	linp.sort()
	lout = []
	for i in range(N - 1):
		lout.append(linp[i + 1] - linp[i])
	print(min(lout))


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


import sys
readin = sys.stdin.readline

def readnums():
	return list(map(int, readin().split()))
T = eval(input())
for i1 in range(T):
	N = eval(input())
	l = readnums()
	l.sort()
	m = 1000000000
	for i2 in range(len(l) - 1):
		if l[i2 + 1] - l[i2] < m:
			m = l[i2 + 1] - l[i2]
	print(m)