Mike is trying rock climbing but he is awful at it. 

There are n holds on the wall, i-th hold is at height a_{i} off the ground. Besides, let the sequence a_{i} increase, that is, a_{i} < a_{i} + 1 for all i from 1 to n - 1; we will call such sequence a track. Mike thinks that the track a_1, ..., a_{n} has difficulty $d = \operatorname{max}_{1 \leq i \leq n - 1}(a_{i + 1} - a_{i})$. In other words, difficulty equals the maximum distance between two holds that are adjacent in height.

Today Mike decided to cover the track with holds hanging on heights a_1, ..., a_{n}. To make the problem harder, Mike decided to remove one hold, that is, remove one element of the sequence (for example, if we take the sequence (1, 2, 3, 4, 5) and remove the third element from it, we obtain the sequence (1, 2, 4, 5)). However, as Mike is awful at climbing, he wants the final difficulty (i.e. the maximum difference of heights between adjacent holds after removing the hold) to be as small as possible among all possible options of removing a hold. The first and last holds must stay at their positions.

Help Mike determine the minimum difficulty of the track after removing one hold.


-----Input-----

The first line contains a single integer n (3 ≤ n ≤ 100) — the number of holds.

The next line contains n space-separated integers a_{i} (1 ≤ a_{i} ≤ 1000), where a_{i} is the height where the hold number i hangs. The sequence a_{i} is increasing (i.e. each element except for the first one is strictly larger than the previous one).


-----Output-----

Print a single number — the minimum difficulty of the track after removing a single hold.


-----Examples-----
Input
3
1 4 6

Output
5

Input
5
1 2 3 4 5

Output
2

Input
5
1 2 3 7 8

Output
4



-----Note-----

In the first sample you can remove only the second hold, then the sequence looks like (1, 6), the maximum difference of the neighboring elements equals 5.

In the second test after removing every hold the difficulty equals 2.

In the third test you can obtain sequences (1, 3, 7, 8), (1, 2, 7, 8), (1, 2, 3, 8), for which the difficulty is 4, 5 and 5, respectively. Thus, after removing the second element we obtain the optimal answer — 4.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Complete search


Solutions:
n = int(input())
a = list(map(int, input().split()))
diffs = [a[i + 1] - a[i] for i in range(n - 1)]
newdiff = diffs[1] + diffs[0]
diff = max(diffs)
for i in range(n - 2):
	newdiff = min(diffs[i] + diffs[i + 1], newdiff)
print(max(diff, newdiff))


from copy import deepcopy
n = int(input())
ls = list(map(int, input().split()))
maxx = -1
ans = []
for i in range(1, n - 1):
	arr = deepcopy(ls)
	arr.remove(ls[i])
	for j in range(n - 2):
		if arr[j + 1] - arr[j] > maxx:
			maxx = arr[j + 1] - arr[j]
	ans.append(maxx)
	maxx = -1
print(min(ans))


from sys import stdin, stdout
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
mi = 0
pnt = 0
for i in range(1, n):
	cur = a[i] - a[i - 1]
	if cur > mi:
		mi = cur
		pnt = i
d = float('inf')
for i in range(1, n - 1):
	if i != pnt:
		tmp = max(mi, a[i + 1] - a[i - 1])
		d = min(tmp, d)
	else:
		d = min(a[i + 1] - a[i - 1], d)
stdout.write(str(d))


n = int(input())
ls = [int(x) for x in input().split()]
max_dif = 10 ** 9
temp_dif = 0
elem_ind = 0
for ind in range(1, len(ls) - 1):
	temp_dif = abs(ls[ind - 1] - ls[ind]) + abs(ls[ind + 1] - ls[ind])
	if temp_dif < max_dif:
		max_dif = min(temp_dif, max_dif)
		elem_ind = ind
del ls[elem_ind]
global_res = -1
for ind in range(1, len(ls)):
	res = abs(ls[ind] - ls[ind - 1])
	global_res = max(global_res, res)
print(global_res)


n = int(input())
list_n = list(map(int, input().split()))
min_list = []

def find_min(l):
	max_d = float('-inf')
	for i in range(len(l) - 1):
		max_d = max(max_d, l[i + 1] - l[i])
	return max_d
for i in range(1, len(list_n) - 1):
	temp = list_n.pop(i)
	min_list.append(find_min(list_n))
	list_n.insert(i, temp)
print(min(min_list))


import functools
import sys

def main():
	n = int(input())
	a = list(map(int, input().split()))
	res = sys.maxsize
	for i in range(1, n - 1):
		tmp = a[:]
		tmp.pop(i)
		dif = 0

		def f(a, b):
			nonlocal dif
			dif = max(b - a, dif)
			return b
		functools.reduce(f, tmp)
		res = min(res, dif)
	print(res)
main()


def main():
	n = int(input())
	a = list(map(int, input().split()))
	min_max = 1000000
	max_diff = 0
	for i in range(1, n - 1):
		max_diff = 0
		c = a[:i] + a[i + 1:]
		for j in range(n - 2):
			max_diff = max(c[j + 1] - c[j], max_diff)
		min_max = min(max_diff, min_max)
	print(min_max)

def __starting_point():
	main()
__starting_point()


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = 9999999
	for i in range(1, n - 1):
		t = a[0:i] + a[i + 1:n]
		k = 0
		for j in range(len(t) - 1):
			k = max(k, t[j + 1] - t[j])
		ans = min(ans, k)
	print(ans)
main()


num = int(input())
arr = list(map(int, input().split()))
curr_score = float('-inf')
for i in range(num - 1):
	curr_score = max(curr_score, arr[i + 1] - arr[i])
new_score = float('inf')
for i in range(num - 2):
	new_score = min(new_score, arr[i + 2] - arr[i])
print(max(new_score, curr_score))


def max(l):
	maxn = 0
	for i in range(1, len(l)):
		if l[i] - l[i - 1] > maxn:
			maxn = l[i] - l[i - 1]
	return maxn
n = int(input())
a = [int(x) for x in input().split()]
ans = []
for i in range(1, n - 1):
	ans.append(max(a[:i] + a[i + 1:]))
print(min(ans))


n = int(input())
L = list(map(int, input().split()))
L1 = [L[k] - L[k - 1] for k in range(1, n)]
L2 = [L1[k] + L1[k + 1] for k in range(n - 2)]
maximo = max(L1)
L3 = [max(maximo, k) for k in L2]
print(min(L3))


def main():
	input()
	a = [int(i) for i in input().split()]
	b = [a[i + 1] - a[i] for i in range(len(a) - 1)]
	c = [b[i + 1] + b[i] for i in range(len(b) - 1)]
	c = [i for i in c if i > max(b)] + [max(b) for i in c if i <= max(b)]
	if len(b) == 2:
		print(c[0])
	else:
		print(min(c))
main()


n = int(input())
lis = list(map(int, input().split()))
dif = abs(lis[1] - lis[0])
pos = []
for i in range(n - 1):
	if abs(lis[i] - lis[i + 1]) > dif:
		dif = abs(lis[i] - lis[i + 1])
for i in range(1, n - 1):
	t = abs(lis[i - 1] - lis[i + 1])
	if t > dif:
		pos.append(t)
	else:
		pos.append(dif)
print(min(pos))


import sys
n = int(input())
a = list(map(int, input().split()))

def difficulty(a):
	ma = 0
	for i in range(1, len(a)):
		if ma < a[i] - a[i - 1]:
			ma = a[i] - a[i - 1]
	return ma
mi = sys.maxsize
for i in range(1, n - 1):
	d = a[:i] + a[i + 1:]
	t = difficulty(d)
	if mi > t:
		mi = t
print(mi)


n = int(input())
a = list(map(int, input().split()))
ans = float('inf')
for i in range(1, n - 1):
	b = a[:i] + a[i + 1:]
	tmp = -float('inf')
	for j in range(1, n - 1):
		tmp = max(tmp, b[j] - b[j - 1])
	ans = min(ans, tmp)
print(ans)


n = int(input())
b = []
a = list(map(int, input().split()))
for _ in range(1, len(a) - 1):
	x = list(a)
	x.pop(_)
	c = []
	for _ in range(len(x) - 1):
		c.append(x[_ + 1] - x[_])
	b.append(max(c))
print(min(b))


n = int(input())
A = list(map(int, input().split()))

def diff(A):
	return max((A[i + 1] - A[i] for i in range(len(A) - 1)))
print(min((diff(A[:i + 1] + A[i + 2:]) for i in range(n - 2))))


n = int(input())
arr = list(map(int, input().split()))
res = 2000000000.0
for i in range(1, n - 1):
	cur = arr[:i] + arr[i + 1:]
	res = min(res, max((cur[j] - cur[j - 1] for j in range(1, len(cur)))))
print(res)


n = int(input())
li = list(map(int, input().split()))
diff = []
ne = []
for i in range(0, n - 1):
	diff.append(li[i + 1] - li[i])
for i in range(1, len(diff)):
	d = diff[:i - 1] + [diff[i - 1] + diff[i]] + diff[i + 1:]
	ne.append(max(d))
print(min(ne))


n = int(input())
L = list(map(int, input().split()))
i = 1
d = 10 ** 10
s = 0
while i + 1 < n:
	if L[i + 1] - L[i - 1] < d:
		d = L[i + 1] - L[i - 1]
		s = i
	i += 1
L.remove(L[s])
i = 0
d = 0
while i + 1 < len(L):
	d = max(d, L[i + 1] - L[i])
	i += 1
print(d)


n = int(input())
data = list(map(int, input().split()))
MIN = abs(data[2] - data[0])
min_index = 1
for i in range(1, n - 1):
	if abs(data[i - 1] - data[i + 1]) < MIN:
		min_index = i
		MIN = abs(data[i - 1] - data[i + 1])
data.pop(min_index)
d = 0
for i in range(len(data) - 1):
	d = max(d, abs(data[i] - data[i + 1]))
print(d)


import copy

def max_jump(a):
	d1 = max([a[i] - a[i - 1] for i in range(1, len(a))])
	return d1
n = int(input())
a = [int(x) for x in input().split(' ')]
m = []
for i in range(1, n - 1):
	b = copy.copy(a)
	b.pop(i)
	m.append(max_jump(b))
print(min(m))


n = int(input())
line = input()
line = line.split()
for i in range(0, n):
	line[i] = int(line[i])
mindif = []
for i in range(1, n - 1):
	if i == 1:
		dif = line[2] - line[0]
	else:
		dif = line[1] - line[0]
	for j in range(1, n):
		if j == i:
			continue
		elif j == i + 1:
			ndif = line[j] - line[j - 2]
		else:
			ndif = line[j] - line[j - 1]
		if ndif > dif:
			dif = ndif
	mindif.append(dif)
mindif.sort()
print(mindif[0])


n = int(input())
a = [int(a) for a in input().split()]
mx = a[1] - a[0]
for i in range(1, n - 1):
	mx = max(mx, a[i + 1] - a[i])
l = []
l.append(max(mx, a[2] - a[0]))
for i in range(1, n - 2):
	l.append(max(mx, a[i + 1] - a[i - 1]))
l.sort()
print(l[0])


n = int(input())
holds = list(map(int, input().split()))
costs = []
for i in range(1, n - 1):
	track = holds[:i] + holds[i + 1:]
	costs.append(max([track[j + 1] - track[j] for j in range(len(track) - 1)]))
print(min(costs))


f = lambda : map(int, input().split())
n = int(input())
l = list(f())
l2 = [l[i] - l[i - 1] for i in range(1, n)]
l3 = []
mx = max(l2)
for i in range(n - 2):
	x = l2[i] + l2[i + 1]
	l3.append(max(x, mx))
print(min(l3))


def main():
	n = int(input())
	rdl = input().split()
	scp = []
	for i in range(len(rdl)):
		scp.append(int(rdl[i]))
	mn = 10000000
	mx = 0
	maxs = []
	for i in range(len(scp) - 1):
		if i != 0:
			mx = 0
			cur = scp[:i] + scp[i + 1:]
			for j in range(len(cur) - 1):
				curt = cur[j + 1] - cur[j]
				if curt > mx:
					mx = curt
			maxs.append(mx)
	mn = 1000000
	for i in range(len(maxs)):
		if maxs[i] < mn:
			mn = maxs[i]
	print(mn)
main()


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


def main():
	n = int(input())
	aa = list(map(int, input().split()))
	bb = [b - a for (b, a) in zip(aa[1:], aa)]
	print(max(min((a + b for (a, b) in zip(bb[1:], bb))), max(bb)))

def __starting_point():
	main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
mi = min((a[i + 2] - a[i] for i in range(n - 2)))
ma = max((a[i + 1] - a[i] for i in range(n - 1)))
print(max(mi, ma))


n = int(input())
a = list(map(int, input().split()))
mx = 10000
for i in range(1, n - 1):
	if mx >= abs(a[i + 1] - a[i - 1]):
		mx = abs(a[i + 1] - a[i - 1])
		idx = i
m = 0
for i in range(1, n):
	m = max(m, abs(a[i] - a[i - 1]))
m = max(m, abs(a[idx + 1] - a[idx - 1]))
print(m)


n = int(input())
l = list(map(int, input().split()))
sum1 = 9999999
sum2 = 0
for i in range(n - 1):
	if l[i + 1] - l[i] > sum2:
		sum2 = l[i + 1] - l[i]
	if i <= n - 3:
		if l[i + 2] - l[i] < sum1:
			sum1 = l[i + 2] - l[i]
print(max(sum1, sum2))


n = int(input())
a = list(map(int, input().split()))
ac = []
for i in a:
	ac.append(i)
for i in range(n - 2):
	d = a[i + 2] - a[i]
	if i == 0:
		m = d
		r = ac.pop(i + 1)
		ri = i + 1
	elif d < m:
		m = d
		ac.insert(ri, r)
		r = ac.pop(i + 1)
		ri = i + 1
	else:
		pass
ma = 0
for i in range(len(ac) - 1):
	h = ac[i + 1] - ac[i]
	ma = max(ma, h)
print(ma)


n = int(input())
r = input().split(' ')

def difficult(arr):
	d = 0
	for i in range(len(arr) - 1):
		l = int(arr[i + 1]) - int(arr[i])
		if l > d:
			d = l
	return d
mind = 2 ** 31 - 1
for j in range(1, n - 1):
	q = r.copy()
	q.pop(j)
	rd = difficult(q)
	if rd < mind:
		mind = rd
print(mind)


n = int(input())
a = list(map(int, input().split()))
t = []
t.sort()
for i in range(len(a) - 1):
	t.append(a[i + 1] - a[i])
start = 0
end = 0
minv = float('inf')
for i in range(len(t) - 1):
	if t[i] + t[i + 1] < minv:
		minv = t[i] + t[i + 1]
		end = i + 1
del a[end]
minv = -float('inf')
for i in range(len(a) - 1):
	if a[i + 1] - a[i] > minv:
		minv = a[i + 1] - a[i]
print(minv)


n = int(input())
array = list(map(int, input().split()))
if len(array) == 3:
	diff = array[2] - array[0]
	print(diff)
else:
	mini = 100001
	for i in range(1, n - 1):
		diff = array[i + 1] - array[i - 1]
		mini = min(mini, diff)
	for i in range(1, n):
		mini = max(mini, array[i] - array[i - 1])
	print(mini)


n = int(input())
b = list(map(int, input().split()))

def max_d(a):
	d = a[1] - a[0]
	for i in range(len(a)):
		if a[i] - a[i - 1] > d:
			d = a[i] - a[i - 1]
	return d
min_diff = max_d(b[:1] + b[2:])
for i in range(1, n - 1):
	if min_diff > max_d(b[:i] + b[i + 1:]):
		min_diff = max_d(b[:i] + b[i + 1:])
print(min_diff)


import sys
import collections
input = sys.stdin.readline

def printnl(val):
	sys.stdout.write(str(val) + '\n')
n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.append(0)
ans = 1000000000
for i in range(1, n - 1):
	answer = 0
	for j in range(n - 1):
		if j == i:
			continue
		if j + 1 == i:
			answer = max(answer, a[j + 2] - a[j])
		else:
			answer = max(answer, a[j + 1] - a[j])
	ans = min(answer, ans)
printnl(ans)


n = int(input())
a = list(map(int, input().split()))
b = []
c = []
for i in range(1, n):
	b.append(a[i] - a[i - 1])
fd = max(b)
for j in range(2, n):
	c.append(a[j] - a[j - 2])
ad = min(c)
if fd > ad:
	print(fd)
else:
	print(ad)


def getmax(a):
	m = -1000000000
	for i in range(len(a) - 1):
		m = max(m, a[i + 1] - a[i])
	return m
n = int(input())
a = [int(x) for x in input().split()]
ans = 1000000000
for i in range(1, n - 1):
	ans = min(ans, max([getmax(a[:i]), getmax(a[i + 1:]), a[i + 1] - a[i - 1]]))
print(ans)


n = int(input())
l = list(map(int, input().rstrip().rsplit()))
x = []
for i in range(n - 2):
	c = l.copy()
	l.pop(i + 1)
	res = [l[j + 1] - l[j] for j in range(len(l) - 1)]
	x.append(max(res))
	l = c
print(min(x))


n = int(input())
a = [int(i) for i in input().split()]
print(max([min([a[i + 2] - a[i] for i in range(n - 2)])] + [a[i] - a[i - 1] for i in range(1, n)]))


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
max_dist = 0
min_dist = 1001
for i in range(n):
	if i >= 2:
		if a[i] - a[i - 2] < min_dist:
			min_dist = a[i] - a[i - 2]
	if i >= 1:
		if a[i] - a[i - 1] > max_dist:
			max_dist = a[i] - a[i - 1]
print(max(min_dist, max_dist))


n = int(input())
s = 0
srr = list()
m = input().split(' ')
m = list(map(int, m))
for i in range(1, n - 1):
	sr = list()
	r = list(m)
	r.pop(i)
	for j in range(n - 2):
		s = r[j + 1] - r[j]
		sr.append(s)
	maxs = max(sr)
	srr.append(maxs)
mins = min(srr)
print(mins)


n = int(input())
l = list(map(int, input().split()))
(k, h) = (list(l), float('inf'))
for i in range(1, n - 1):
	k.remove(l[i])
	h = min(h, max([k[i + 1] - k[i] for i in range(0, n - 2)]))
	k = list(l)
print(h)


n = int(input())
a = list(map(int, input().split()))
ans = 1 << 50
for i in range(1, n - 1):
	tmp = 0
	for lo in range(n - 1):
		if lo == i:
			continue
		hi = lo + 1
		if hi == i:
			hi += 1
		tmp = max(tmp, a[hi] - a[lo])
	ans = min(ans, tmp)
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = a
l = []
for i in range(1, n - 1):
	ld = []
	b = b[0:i] + b[i + 1:]
	for j in range(1, len(b)):
		d = b[j] - b[j - 1]
		ld.append(d)
	l.append(max(ld))
	b = a
print(min(l))


n = int(input())
l = list(map(int, input().split()))
m = 1001
for i in range(1, n - 1):
	t = l.copy()
	t.remove(l[i])
	diff = [-1] * n
	for j in range(1, n - 1):
		diff[j] = t[j] - t[j - 1]
	m = min(max(diff), m)
print(m)


n = int(input())

def diff(li):
	return max([li[i + 1] - li[i] for i in range(n - 2)])
l = list(map(int, input().split()))
l2 = [l[i + 2] - l[i] for i in range(n - 2)]
l.pop(1 + l2.index(min(l2)))
print(diff(l))


a = int(input())
h = list(map(int, input().split()))

def diff(l):
	return max([l[i + 1] - l[i] for i in range(len(l) - 1)])
k = [i for i in h]
x = []
for i in range(1, a - 1):
	k.pop(i)
	x.append(diff(k))
	k = [j for j in h]
print(min(x))


count = int(input())
points = input().split(' ')
maxes = []
for i in range(1, count - 1):
	pointsDistance = []
	pointsCopy = points.copy()
	pointsCopy.remove(points[i])
	for index in range(len(pointsCopy) - 1):
		distance = int(pointsCopy[index + 1]) - int(pointsCopy[index])
		pointsDistance.append(distance)
	maxes.append(max(pointsDistance))
print(min(maxes))


(n, t) = (int(input()) - 1, list(map(int, input().split())))
print(max(max((t[i + 1] - t[i] for i in range(n))), min((t[i + 2] - t[i] for i in range(n - 1)))))


n = int(input())
lis = input().split()
for i in range(n):
	lis[i] = int(lis[i])

def diff(a):
	m = a[1] - a[0]
	for i in range(1, len(a) - 1):
		if a[i + 1] - a[i] > m:
			m = a[i + 1] - a[i]
	return m
lis2 = []
for i in range(1, n - 1):
	lis2.append(diff(lis[:i] + lis[i + 1:]))
print(min(lis2))


maxof = 0
minof = 1000
n = int(input())
a = [int(x) for x in input().split()]
flag = False
for i in range(1, n):
	if a[i] - a[i - 1] > maxof:
		maxof = a[i] - a[i - 1]
for i in range(2, n):
	if a[i] - a[i - 2] < maxof:
		flag = True
		break
	if a[i] - a[i - 2] < minof:
		minof = a[i] - a[i - 2]
if flag == False:
	print(minof)
else:
	print(maxof)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	m = 0
	a = list(map(int, input().split()))
	pair = []
	for i in range(1, n - 1):
		pair.append([a[i + 1] - a[i - 1], i])
	pair.sort()
	a.remove(a[pair[0][1]])
	for i in range(1, n - 1):
		m = max(a[i] - a[i - 1], m)
	print(m)
for _ in range(1):
	solve()


n = int(input())
a = list(map(int, input().split()))
ans = 12345
for i in range(1, n - 1):
	b = a[:i] + a[i + 1:]
	ans = min(ans, max((b[j + 1] - b[j] for j in range(n - 2))))
print(ans)


n = int(input())
a = list(map(int, input().split()))
d = [0] * n
x = 0
y = pow(10, 20)
for i in range(1, n):
	d[i] = a[i] - a[i - 1]
	x = max(x, d[i])
for i in range(2, n):
	y = min(y, d[i] + d[i - 1])
	z = max(y, x)
print(z)


number = int(input())
l = list(map(int, input().split(' ')))
p = set()
aMax = l[1] - l[0]
iMax = 0
for x in range(number - 1):
	cMax = l[x + 1] - l[x]
	if cMax > aMax:
		aMax = cMax
		iMax = x
	p.add(l[x + 1] - l[x])
if len(p) != 1:
	p.remove(aMax)
	sMax = max(p)
else:
	sMax = aMax
q = set()
for t in range(number - 2):
	if t != iMax:
		q.add(max(l[t + 2] - l[t], aMax))
	else:
		q.add(max(l[t + 2] - l[t], sMax))
print(min(q))


n = int(input())
l = [int(x) for x in input().split()]
k = 1001
for i in range(1, n - 1):
	g = sorted(l)
	g.pop(i)
	c = 0
	for j in range(1, len(g)):
		c = max(c, g[j] - g[j - 1])
	k = min(k, c)
print(k)


n = int(input())
arr = list(map(int, input().split()))
maxArr = []
for i in range(1, n - 1):
	tempMax = float('-inf')
	for j in range(n - 1):
		if j == i:
			continue
		elif j == i - 1:
			tempMax = max(tempMax, arr[i + 1] - arr[j])
		else:
			tempMax = max(tempMax, arr[j + 1] - arr[j])
	maxArr.append(tempMax)
print(min(maxArr))


n = int(input())
l = list(map(int, input().split()))
d = []
for i in range(n - 2):
	m = 1
	for j in range(n - 2):
		if j == i:
			if l[j + 2] - l[j] > m:
				m = l[j + 2] - l[j]
		elif j > i:
			if l[j + 2] - l[j + 1] > m:
				m = l[j + 2] - l[j + 1]
		elif l[j + 1] - l[j] > m:
			m = l[j + 1] - l[j]
	d.append(m)
print(min(d))


n = int(input())
A = list(map(int, input().split()))
ans = 10000
num = 0
for i in range(0, n - 2):
	if A[i + 2] - A[i] < ans:
		ans = A[i + 2] - A[i]
		num = i + 1
for i in range(0, n - 1):
	if i != num and i + 1 != num:
		ans = max(ans, A[i + 1] - A[i])
print(ans)


def solve(n, l):
	difficulties = []
	_max = 0
	for i in range(1, n):
		d = l[i] - l[i - 1]
		difficulties.append(d)
		_max = max(_max, d)
	new_difficult = 1000 * 2
	for i in range(1, len(difficulties)):
		new_difficult = min(new_difficult, difficulties[i] + difficulties[i - 1])
	return max(new_difficult, _max)

def solve2(n, l):
	difficulty = -1
	for i in range(1, n):
		difficulty = max(difficulty, l[i] - l[i - 1])
	new_difficult = 1000 * 2
	for i in range(2, n):
		new_difficult = min(new_difficult, l[i] - l[i - 2])
	return max(difficulty, new_difficult)
n = int(input())
l = list(map(int, input().split()))
print(solve2(n, l))


n = int(input())
a = list(map(int, input().split()))
dist = 10000
for i in range(1, n - 1):
	b = a[:i] + a[i + 1:]
	tmp = max([b1 - b0 for (b1, b0) in zip(b[1:], b[:-1])])
	if tmp < dist:
		dist = tmp
print(dist)


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


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	A = read_ints()
	L = [0 for _ in range(n)]
	R = [0 for _ in range(n)]
	for i in range(1, n):
		L[i] = max(L[i - 1], A[i] - A[i - 1])
	for i in range(n - 2, -1, -1):
		R[i] = max(R[i + 1], A[i + 1] - A[i])
	d = float('inf')
	for i in range(1, n - 1):
		d = min(d, max(L[i], R[i + 1], A[i + 1] - A[i - 1]))
	print(d)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		debug(n, i)
		if n % i == 0:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P

def is_lucky(n):
	return set(list(str(n))).issubset({'4', '7'})
main()


n = int(input())
track = [int(x) for x in input().split()]
min_diff = list()
x = 1
while x >= 1 and x < n - 1:
	min_diff.append(track[x] - track[x - 1] + (track[x + 1] - track[x]))
	x += 1
mini = 0
for i in range(len(min_diff)):
	if min_diff[i] < min_diff[mini]:
		mini = i
del track[mini + 1]
if n - 1 == 2:
	print(track[1] - track[0])
else:
	x = 1
	min_diff.clear()
	while x >= 1 and x < n - 1:
		min_diff.append(track[x] - track[x - 1])
		x += 1
	print(max(min_diff))


n = int(input())
a = list((int(i) for i in input().split()))
b = []
for i in range(1, n):
	b.append(a[i] - a[i - 1])
bd = max(b)
c = []
for i in range(1, n - 1):
	c.append(b[i] + b[i - 1])
cd = min(c)
d = max(bd, cd)
print(d)


def maxdist(l):
	n = len(l)
	return max((l[i] - l[i - 1] for i in range(1, n)))
n = int(input())
ans = 10000000000
l = [int(i) for i in input().split()]
for i in range(1, n - 1):
	curr = maxdist(l[0:i] + l[i + 1:])
	ans = min(ans, curr)
print(ans)


n = int(input())
st = input().split(' ')
max = 0
st1 = []
for i in range(1, n - 1):
	for k in range(n - 1):
		if k == i:
			rast = int(st[k + 1]) - int(st[k - 1])
		else:
			rast = int(st[k + 1]) - int(st[k])
		if rast > max:
			max = rast
	st1.append(max)
	max = 0
min = int(st1[0])
for i in range(len(st1)):
	if st1[i] < min:
		min = int(st1[i])
print(min)


n = int(input())
l = [int(i) for i in input().split()]
(z, mi) = ([], None)
if len(l) == 3:
	print(l[2] - l[0])
else:
	for j in range(n):
		if j > 0:
			z.append(l[j] - l[j - 1])
		if j > 1:
			if mi == None:
				mi = j - 2
			elif z[mi] + z[mi + 1] > z[j - 2] + z[j - 1]:
				mi = j - 2
	print(max(z[mi] + z[mi + 1], max(z)))


n = int(input())
l = list(map(int, input().split()))
k = []
for i in range(1, n):
	k += [l[i] - l[i - 1]]
ma = max(k)
mi = 11 ** 11
for i in range(1, n - 1):
	t = k[i] + k[i - 1]
	if t < mi:
		mi = t
	if mi < ma:
		mi = ma
		break
print(mi)


n = input()
n = int(n)
holds = []
diffs = []
holds = list(map(int, input().split()))
counter = 1
while counter < n - 1:
	diff = holds[counter + 1] - holds[counter - 1]
	i = 1
	while i <= n - 1:
		if i - 1 == counter or i == counter:
			i += 1
			continue
		if holds[i] - holds[i - 1] > diff:
			diff = holds[i] - holds[i - 1]
		i += 1
	diffs.append(diff)
	counter = counter + 1
diffs.sort()
print(diffs[0])


t = int(input())
a = list(map(int, input().split()))

def diff(a):
	return max((a[i + 1] - a[i] for i in range(len(a) - 1)))
print(min((diff(a[:i + 1] + a[i + 2:]) for i in range(t - 2))))


n = int(input())
a = list(map(int, input().split()))
m = []
max1 = 0
for i in range(n - 1):
	p = a[i + 1] - a[i]
	if p > max1:
		max1 = p
d = []
for i in range(n - 2):
	d.append(max(a[i + 2] - a[i], max1))
print(min(d))


import math

def solve(arr, n):
	max_diff = -math.inf
	result = math.inf
	for i in range(1, n):
		max_diff = max(max_diff, arr[i] - arr[i - 1])
	for i in range(1, n - 1):
		result = min(result, max(max_diff, arr[i + 1] - arr[i - 1]))
	return result
n = int(input())
arr = list(map(int, input().strip().split()))
result = solve(arr, n)
print(result)


n = int(input())
arr = list(map(int, input().strip().split(' ')))
ans = 10000000
for i in range(1, n - 1):
	m = -1000000
	for j in range(n - 1):
		if j == i:
			continue
		elif j + 1 == i:
			m = max(arr[j + 2] - arr[j], m)
		else:
			m = max(arr[j + 1] - arr[j], m)
	if m < ans:
		ans = m
print(ans)


def maxL(ld):
	maxl = 0
	for i in range(1, len(ld)):
		if ld[i] - ld[i - 1] > maxl:
			maxl = ld[i] - ld[i - 1]
	return maxl
n = int(input())
l = [int(x) for x in input().split(' ')]
m = []
for i in range(2, n):
	m.append(maxL(l[:i - 1] + l[i:]))
print(min(m))


n = int(input())
a = list(map(int, input().split()))
m = int(0)
k = []
for i in range(1, n - 1):
	b = a[:i] + a[i + 1:]
	m = int(0)
	for j in range(n - 2):
		m = max(m, abs(b[j] - b[j + 1]))
	k.append(m)
print(min(k))


n = int(input())
arr = list(map(int, input().split()))
dif = float('inf')
for i in range(2, n):
	if dif > arr[i] - arr[i - 2]:
		dif = arr[i] - arr[i - 2]
		rem = i - 1
arr.pop(rem)
ans = float('-inf')
for i in range(1, len(arr)):
	ans = max(ans, arr[i] - arr[i - 1])
print(ans)


numholds = input()
numholds = int(numholds)
holds = input().split(' ')
holds = list(map(int, holds))

def best_case():
	max_dist = 1002
	for case in range(1, numholds - 1):
		testholds = []
		for i in range(numholds):
			if i != case:
				testholds.append(holds[i])
		if find_max_dist(testholds) < max_dist:
			max_dist = find_max_dist(testholds)
	return max_dist

def find_max_dist(testholds):
	max_dist = 0
	for i in range(0, len(testholds) - 1):
		if testholds[i + 1] - testholds[i] > max_dist:
			max_dist = testholds[i + 1] - testholds[i]
	return max_dist
print(best_case())


n = int(input())
a = [int(x) for x in input().split(' ')]
d = []
maxd = 0
for i in range(n - 1):
	d.append(a[i + 1] - a[i])
	maxd = max(maxd, d[i])
mind = 1000000000
for i in range(1, len(d)):
	if d[i - 1] + d[i] <= maxd:
		mind = maxd
	else:
		mind = min(mind, d[i - 1] + d[i])
print(mind)


import sys
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in range(n - 1):
	x = max(a[i + 1] - a[i], x)
y = sys.maxsize
for i in range(n - 2):
	y = min(a[i + 2] - a[i], y)
print(max(x, y))


n = int(input())
a = [0] * n
min = 9999999999
a = list(map(int, input().split()))
p = [0] * n
k = [0] * (n - 1)
for i in range(0, n - 2):
	max = 0
	p = a.copy()
	p.pop(i + 1)
	k = p.copy()
	for m in range(0, n - 2):
		t = abs(k[m] - k[m + 1])
		if t > max:
			max = t
	if max < min:
		min = max
print(min)


n = int(input())
a_values = list(map(int, input().split()))
max_values = []
for i in range(1, n - 1):
	b = a_values[:i] + a_values[i + 1:]
	b_max = 0
	for b_index in range(len(b) - 1):
		b_max = max(b_max, b[b_index + 1] - b[b_index])
	max_values.append(b_max)
print(min(max_values))


n = int(input())
l = [int(x) for x in input().split()]
k = list(l)
l1 = []
for i in range(1, len(l) - 1):
	k.remove(l[i])
	m = 0
	for j in range(n - 2):
		a = k[j + 1] - k[j]
		m = max(a, m)
	l1.append(m)
	k = list(l)
print(min(l1))


a = int(input())
b = list(map(int, input().split()))
m = max(b)
for i in range(1, a - 1):
	if m > b[i + 1] - b[i - 1]:
		m = b[i + 1] - b[i - 1]
for i in range(1, a):
	if m < b[i] - b[i - 1]:
		m = b[i] - b[i - 1]
print(m)


n = int(input().strip())
ll = list(map(int, input().split()))
ll1 = [0] * (n - 1)
for i in range(n - 1):
	ll1[i] = ll[i + 1] - ll[i]
maxx = max(ll1)
ll2 = []
for i in range(n - 2):
	ll2.append(max(maxx, ll1[i] + ll1[i + 1]))
print(min(ll2))


n = int(input())
l = list(map(int, input().split()))
ans = 10000000000000
for i in range(1, n - 1):
	dup = l[:]
	dup.pop(i)
	diff = -1
	for j in range(len(dup) - 1):
		diff = max(dup[j + 1] - dup[j], diff)
	ans = min(ans, diff)
print(ans)


def d(L, k):
	res = -1
	for i in range(len(L) - 1):
		if i != k and i + 1 != k:
			res = max(res, L[i + 1] - L[i])
		elif i == k:
			res = max(res, L[i + 1] - L[i - 1])
		elif i + 1 == k:
			res = max(res, L[i + 2] - L[i])
	return res
n = int(input())
A = list(map(int, input().split()))
ans = 10000000
for i in range(1, n - 1):
	ans = min(ans, d(A, i))
print(ans)


n = int(input())
arr = list(map(int, input().split()))
prevDist = 0
for i in range(n - 1):
	prevDist = max(prevDist, arr[i + 1] - arr[i])
mini = 9999999999999
for i in range(n - 2):
	mini = min(mini, arr[i + 2] - arr[i])
print(max(mini, prevDist))


(a, l) = (int(input()), list(map(int, input().split())))
s = []
for x in range(1, a - 1):
	z = l[x]
	l.remove(z)
	k = []
	for y in range(1, a - 1):
		k.append(l[y] - l[y - 1])
	s.append(max(k))
	l.insert(x, z)
print(min(s))


def getrazn(ar):
	e = 0
	for i in range(len(ar)):
		if ar[i] - ar[i - 1] > e:
			e = ar[i] - ar[i - 1]
	return e
input()
a = list(map(int, input().split()))
ranz = []
for i in range(1, len(a) - 1):
	acopy = a.copy()
	del acopy[i]
	ranz.append(getrazn(acopy))
print(min(ranz))


n = int(input())
x = list(map(int, input().split(' ')))
(M, Max, z) = (100000000000, 0, 0)
for i in range(1, n - 1):
	for j in range(1, n):
		z = j - 1
		if i == j:
			j -= 1
		if j - 1 == i:
			z -= 1
		Max = max(x[j] - x[z], Max)
	M = min(Max, M)
	Max = 0
print(M)


trash = int(input())
secondLine = [int(x) for x in input().split()]
low = 9999999999999
low2 = -9999999999999
for i in range(2, len(secondLine)):
	if secondLine[i] - secondLine[i - 2] < low:
		low = secondLine[i] - secondLine[i - 2]
for i in range(1, len(secondLine)):
	if secondLine[i] - secondLine[i - 1] > low2:
		low2 = secondLine[i] - secondLine[i - 1]
print(max(low, low2))


holds = int(input())
heights = [int(i) for i in input().split()]
ans = 999999999
real = heights
for i in range(1, len(heights) - 1):
	app = heights[i]
	heights.remove(app)
	k = 0
	for j in range(len(heights) - 1):
		k = max(heights[j + 1] - heights[j], k)
	ans = min(ans, k)
	heights.append(app)
	heights = sorted(heights)
print(ans)


n = int(input())
l = list(map(int, input().split()))
m = []
for i in range(1, n - 1):
	a = []
	y = l[i]
	l.pop(i)
	for j in range(n - 2):
		d = l[j + 1] - l[j]
		a.append(d)
	m.append(max(a))
	l.insert(i, y)
print(min(m))


n = int(input())
a = list(map(int, input().split()))

def f(a):
	mm = float('-inf')
	for x in range(len(a) - 1):
		mm = max(mm, a[x + 1] - a[x])
	return mm
(ans, ansx) = (-1, float('+inf'))
for i in range(1, n - 1):
	nn = f(a[:i] + a[i + 1:])
	if nn < ansx:
		(ans, ansx) = (i, nn)
print(ansx)


n = int(input())
a = list(map(int, input().split()))
if n == 3:
	print(a[2] - a[0])
else:
	large = 0
	small = a[2] - a[0]
	index = 1
	for i in range(3, n):
		large = a[i] - a[i - 2]
		if large < small:
			small = large
			index = i - 1
	a.pop(index)
	print(max((a[i] - a[i - 1] for i in range(1, n - 1))))


n = int(input())
holdList = [int(i) for i in input().split()]
(tmpList, minDif, maxDif) = ([], max(holdList), 0)
for i in range(1, n - 1):
	tmpList = holdList[:i] + holdList[i + 1:]
	for j in range(0, n - 2):
		maxDif = max(maxDif, tmpList[j + 1] - tmpList[j])
	(minDif, maxDif) = (min(minDif, maxDif), 0)
print(minDif)


def dif(x):
	return max([b - a for (b, a) in zip(x[1:], x[:-1])])

def main(n, a):
	mn = dif(a) * 100000000000.0
	for i in range(1, len(a) - 1):
		x = dif(a[:i] + a[i + 1:])
		if x < mn:
			mn = x
	print(mn)

def main_input():
	n = int(input())
	a = [int(i) for i in input().split()]
	main(n, a)

def __starting_point():
	main_input()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
d = []
for i in range(1, n - 1):
	temp = a[:]
	temp.remove(temp[i])
	tempD = -1
	for x in range(1, len(temp)):
		tempD = max(tempD, temp[x] - temp[x - 1])
	d.append(tempD)
d.sort()
print(d[0])


n = int(input())
a = list(map(int, input().split()))
m = -1
ans = 0
d = []
for i in range(1, n - 1):
	d += [abs(a[i - 1] - a[i + 1])]
p = d.index(min(d))
a.remove(a[p + 1])
for i in range(n - 2):
	ans = max(ans, abs(a[i] - a[i + 1]))
print(ans)


n = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 1000
for i in range(1, len(l) - 1):
	li = l[:]
	li.remove(l[i])
	m = 0
	for j in range(len(li) - 1):
		m = max(li[j + 1] - li[j], m)
	ans = min(m, ans)
print(ans)


n = int(input())
x = list(map(int, input().split()))
a = []
first = []
new = []
for i in range(n - 1):
	j = i + 1
	k = j + 1
	d = x[j] - x[i]
	if i == 0 or i == n - 2:
		first.append(d)
	else:
		a.append(d)
	if k < n:
		h = x[k] - x[i]
		new.append(h)
ma = max(a + first + [min(new)])
print(ma)


n = int(input())
a = []
m = map(int, input().split())
for k in m:
	a.append(k)
mine = 1000
for j in range(1, n - 1):
	maxe = 0
	for i in range(n - 1):
		if i + 1 == j:
			maxe = max(maxe, a[i + 2] - a[i])
		if i == j:
			3 / 2
		else:
			maxe = max(maxe, a[i + 1] - a[i])
	mine = min(mine, maxe)
print(mine)


n = int(input())
a = [int(x) for x in input().split()]
b = -1
for i in range(n - 2):
	if b == -1 or a[b + 2] - a[b] > a[i + 2] - a[i]:
		b = i
c = 0
for i in range(n - 1):
	c = max(c, 0 if i == b + 1 else a[i + 1 + (i == b)] - a[i])
print(c)


__author__ = 'Rakshak.R.Hegde'
n = int(input())
a = list(map(int, input().split()))
minI = min(range(1, n - 1), key=lambda x: a[x + 1] - a[x - 1])
a.pop(minI)
maxI = max(range(1, n - 1), key=lambda x: a[x] - a[x - 1])
print(a[maxI] - a[maxI - 1])


def diff(n):
	dif = 0
	for i in range(len(n) - 1):
		if dif < n[i + 1] - n[i]:
			dif = n[i + 1] - n[i]
	return dif
n = int(input())
holes = list(map(int, input().split()))
tmp = []
diffs = []
for i in range(1, len(holes) - 1):
	for j in holes:
		if holes[i] == j:
			continue
		else:
			tmp.append(j)
	diffs.append(diff(tmp))
	tmp = []
print(min(diffs))


n = int(input())
l = list(map(int, input().split()))
mi = l[-1] - l[0]
for i in range(1, n - 1):
	if l[i + 1] - l[i - 1] < mi:
		mi = l[i + 1] - l[i - 1]
mx = max([l[i] - l[i - 1] for i in range(1, n)])
print(max(mi, mx))


def D(a):
	m = []
	for i in range(len(a) - 1):
		m.append(a[i + 1] - a[i])
	return max(m)
res = 10000
n = int(input())
l = list(map(int, input().split()))
y = []
for i in range(1, n - 1):
	f = l.copy()
	f.remove(f[i])
	re = D(f)
	y.append(re)
print(min(y))


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


n = int(input())
ai = list(map(int, input().split()))
ai2 = [ai[i + 1] - ai[i] for i in range(n - 1)]
ai3 = [ai[i + 2] - ai[i] for i in range(n - 2)]
print(max(max(ai2), min(ai3)))


z = int(input())
a = list(map(int, input().split()))
k = max(a)
j = 0
for i in range(z - 1):
	if i < z - 2:
		k = min(k, a[i + 2] - a[i])
	j = max(j, a[i + 1] - a[i])
print(max(j, k))


input()
x = [int(n) for n in input().split()]
t = len(x) - 1
mi = 10000000000000
for i in range(1, t):
	mins = 0
	temp2 = 0
	for j in range(t):
		if j + 1 == i:
			mins = x[j + 2] - x[j]
		elif i != j:
			mins = x[j + 1] - x[j]
		temp2 = max(mins, temp2)
	mi = min(mi, temp2)
print(mi)


def arr_inp():
	return [int(x) for x in input().split()]
(n, a) = (int(input()), arr_inp())
a_max = []
for i in range(n - 2):
	(a_copy, ma) = (a.copy(), 0)
	a_copy.pop(i + 1)
	for j in range(n - 2):
		diff = a_copy[j + 1] - a_copy[j]
		if diff > ma:
			ma = diff
	a_max.append(ma)
print(min(a_max))


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	arr = intl()
	ans = 10 ** 10
	for i in range(1, n - 1):
		m = 0
		for j in range(n - 1):
			if j == i - 1:
				m = max(m, arr[i + 1] - arr[j])
			elif j == i:
				continue
			else:
				m = max(arr[j + 1] - arr[j], m)
		ans = min(ans, m)
	print(ans)
solve()


n = int(input())
h = list(map(int, input().split()))
bestDist = h[2] - h[0]
for i in range(1, n - 2):
	bestDist = min(h[i + 2] - h[i], bestDist)
dist = -1
for i in range(n - 1):
	dist = max(dist, h[i + 1] - h[i])
print(max(bestDist, dist))


import sys
I = lambda : map(int, input().split())
n = int(input())
a = list(I())
MIN = float('inf')
MAX = -MIN
for i in range(1, n):
	MAX = max(MAX, a[i] - a[i - 1])
for i in range(1, n - 1):
	y = max(MAX, a[i + 1] - a[i - 1])
	MIN = min(MIN, y)
print(MIN)


n = int(input())
(a, b, c) = ([], [], [])
v = list(map(int, input().split()))
for x in range(0, len(v) - 2):
	a.append(v[x + 2] - v[x])
c.append(min(a))
for x in range(n - 1):
	b.append(v[x + 1] - v[x])
print(max(c + b))


n = int(input())
m = [int(x) for x in input().split()]
a = []
for i in range(1, n):
	a.append(m[i] - m[i - 1])
b = m[n - 1]
c = max(a)
for j in range(1, n - 1):
	d = a[j - 1] + a[j]
	d = max(d, c)
	b = min(b, d)
print(b)


import math as m
t = input
n = int(t())
a = list(map(int, t().split()))
print(max(max([a[i + 1] - a[i] for i in range(n - 1)]), min([a[i + 2] - a[i] for i in range(n - 2)])))


n = int(input())
t = [int(x) for x in input().split()]
d = []
for i in range(n):
	x = list.copy(t)
	if i != 0 and i != n - 1:
		x.pop(i)
		max = 0
		for e in range(n - 2):
			if x[e + 1] - x[e] > max:
				max = x[e + 1] - x[e]
		d.append(max)
print(min(d))


n = int(input())
a = list(map(int, input().split()))
min = 10000000000000
f = 0
for i in range(1, n - 1):
	if a[i + 1] - a[i - 1] <= min:
		f = i
		min = a[i + 1] - a[i - 1]
a.pop(f)
col = 0
for i in range(1, n - 1):
	if a[i] - a[i - 1] > col:
		col = a[i] - a[i - 1]
print(col)


n = int(input())
a = list(map(int, input().split()))
d = 0
array = []
for i in range(1, n):
	array.append(a[i] - a[i - 1])
	d = max(d, a[i] - a[i - 1])
d2 = a[n - 1] - a[0]
for i in range(1, len(array)):
	d2 = min(d2, array[i] + array[i - 1])
print(max(d2, d))


x = input()
inp = input().split(' ')
if len(inp) == 3:
	print(int(inp[2]) - int(inp[0]))
else:
	res = []
	for i in range(1, len(inp) - 1):
		ans = -1
		for j in range(1, len(inp)):
			if i == j:
				ans = max(ans, int(inp[j + 1]) - int(inp[j - 1]))
			else:
				ans = max(ans, int(inp[j]) - int(inp[j - 1]))
		res.append(ans)
	print(min(res))


n = int(input())
a = [int(i) for i in input().split()]
e = 1
d = []
while e < len(a) - 1:
	l = []
	p = a[e]
	a.pop(e)
	for i in range(1, len(a)):
		l.append(a[i] - a[i - 1])
	d.append(max(l))
	a.insert(e, p)
	e = e + 1
print(min(d))


from sys import stdin, stdout
n = int(stdin.readline().strip())
height_lst = list(map(int, stdin.readline().split()))
diff_lst = []
for i in range(1, n - 1):
	popped = height_lst.pop(i)
	max_diff = height_lst[1] - height_lst[0]
	for j in range(2, n - 1):
		max_diff = max(max_diff, height_lst[j] - height_lst[j - 1])
	diff_lst.append(max_diff)
	height_lst.insert(i, popped)
req_num = min(diff_lst)
stdout.write(str(req_num))


n = int(input())
dist = [int(x) for x in input().split()]
_min = dist[-1] - dist[0]
removed = dist[1]
for i in range(n - 2):
	atual = dist[i + 2] - dist[i]
	if atual < _min:
		_min = atual
		removed = dist[i + 1]
dist.remove(removed)
_max = dist[1] - dist[0]
for i in range(n - 2):
	atual = dist[i + 1] - dist[i]
	if _max < atual:
		_max = atual
print(_max)


n = int(input())
a = [int(x) for x in input().split()]
mi = 10000
miind = 0
for i in range(1, n - 1):
	diff = abs(a[i - 1] - a[i + 1])
	if diff < mi:
		mi = diff
		miind = i
a.pop(miind)
ma = 0
for i in range(n - 2):
	ma = max(ma, abs(a[i] - a[i + 1]))
print(ma)


TN = 1

def solution():
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	for i in range(1, n - 1):
		b = a[:i] + a[i + 1:]
		l = []
		for j in range(n - 2):
			l.append(b[j + 1] - b[j])
		ans.append(max(l))
	print(min(ans))
while TN != 0:
	solution()
	TN -= 1


n = int(input())
l = list(map(int, input().split()))
ans = []
for i in range(1, n - 1):
	x = []
	for j in l:
		if j != l[i]:
			x.append(j)
	mx = 0
	for j in range(1, len(x)):
		diff = x[j] - x[j - 1]
		if diff > mx:
			mx = diff
	ans.append(mx)
print(min(ans))


n = int(input().strip())
arr = list(map(int, input().strip().split()))
prevMax = 0
for i in range(n - 1):
	prevMax = max(prevMax, arr[i + 1] - arr[i])
mini = 999999999999999
for i in range(n - 2):
	mini = min(mini, arr[i + 2] - arr[i])
print(max(mini, prevMax))


n = int(input())
l = list(map(int, input().split()))
lp = []
for i in range(1, n - 1):
	li = [ij for ij in l]
	li.pop(i)
	d = 0
	for j in range(n - 2):
		diff = li[j + 1] - li[j]
		if diff > d:
			d = diff
	lp.append(d)
print(min(lp))


def calc_dist(k, n):
	l = []
	for i in range(n):
		if i != 0:
			l.append(k[i] - k[i - 1])
			l.sort()
	return l[-1]
n = int(input())
t = input().split(' ')
f = []
for i in range(n):
	f.append(int(t[i]))
t = f
l = []
k = []
for i in range(1, n - 1):
	l = l + t
	l.remove(t[i])
	k.append(int(calc_dist(l, n - 1)))
	l = []
k.sort()
print(k[0])


n = int(input())
l = list(map(int, input().split()))
p = []
for i in range(1, n - 1):
	x = l[:i] + l[i + 1:]
	t = x[0]
	c = -2636263637236665
	for j in x[1:]:
		g = j - t
		if g > c:
			c = g
		t = j
	p.append(c)
print(min(p))


n = int(input())
s = input().split()
a = []
b = []
for i in range(0, n - 1):
	k = int(s[i + 1]) - int(s[i])
	a.append(k)
for i in range(0, n - 2):
	k = a[i] + a[i + 1]
	b.append(k)
c = max(a)
d = min(b)
if c < d:
	print(d)
else:
	print(c)


n = int(input())
l = list(map(lambda x: int(x), input().split()))
res = 1000
for i in range(1, n - 1):
	d = l.pop(i)
	m = 1
	for j in range(0, n - 2):
		m = max(l[j + 1] - l[j], m)
	res = min(res, m)
	l.insert(i, d)
print(res)


n = int(input())
l = list(map(int, input().split()))
if len(l) <= 3:
	print(l[2] - l[0])
else:
	A = []
	B = []
	for i in range(len(l)):
		if i != len(l) - 1 and i != 0:
			a = l.pop(i)
			for j in range(len(l)):
				if j != len(l) - 1:
					A.append(l[j + 1] - l[j])
			B.append(max(A))
			A = []
			l.append(a)
			l.sort()
	print(min(B))


n = int(input())
a = list(map(int, input().split()))
d = []
if len(a) > 3:
	for i in range(1, n - 1):
		l = []
		for j in range(n - 1):
			if j == i:
				pass
			elif j == i - 1:
				l.append(a[j + 2] - a[j])
			elif j != i - 1:
				l.append(a[j + 1] - a[j])
		d.append(max(l))
else:
	d.append(a[len(a) - 1] - a[0])
print(min(d))


n = int(input())
a = [int(i) for i in input().split()]
lst = []
for i in range(n - 1):
	lst.append(a[i + 1] - a[i])
ans = []
f = len(lst)
for i in range(f - 1):
	lst1 = lst[:]
	p = lst[i] + lst[i + 1]
	lst1.pop(i)
	lst1.pop(i)
	if lst1 == []:
		k = 0
	else:
		k = max(lst1)
	mx = max(p, k)
	ans.append(mx)
print(min(ans))


n = int(input())
arr = list(map(int, input().split()))
diff = arr[2] - arr[0]
index = 1
for i in range(1, n - 2):
	if arr[i + 2] - arr[i] < diff:
		diff = arr[i + 2] - arr[i]
		index = i + 1
del arr[index]
maxi = arr[1] - arr[0]
for i in range(1, n - 2):
	if arr[i + 1] - arr[i] > maxi:
		maxi = arr[i + 1] - arr[i]
print(maxi)


n = int(input())
l = list(map(int, input().split()))
if n == 3:
	print(l[2] - l[0])
else:
	diff = []
	for i in range(1, n - 1):
		sub = l[:i] + l[i + 1:]
		diff.append(max([sub[j + 1] - sub[j] for j in range(len(sub) - 1)]))
	print(min(diff))


n = int(input())
l = list(map(int, input().split()))
ans1 = []
ans2 = []
for i in range(n - 1):
	ans1.append(abs(l[i] - l[i + 1]))
for i in range(n - 2):
	ans2.append(abs(l[i] - l[i + 2]))
print(max(max(ans1), min(ans2)))


n = int(input())
a = input()
A = []
for i in a.split():
	A.append(int(i))
Max = 0
b = 0
c = 0
for j in range(0, n - 1):
	if A[j + 1] - A[j] > Max:
		Max = A[j + 1] - A[j]
		b = j
B = []
for k in range(0, n - 2):
	if A[k + 2] - A[k] <= Max:
		c = 1
		break
	if A[k + 2] - A[k] > Max:
		B.append(A[k + 2] - A[k])
if c == 1:
	print(Max)
elif c == 0:
	print(min(B))


N = int(input())
A = list(map(int, input().split()))

def fn(n):
	i = 0
	ret = -1e+30
	while i < N - 1:
		if i != n:
			diff = A[i + 1] - A[i]
			i += 1
		else:
			diff = A[i + 2] - A[i]
			i += 2
		ret = max(ret, diff)
	return ret
ans = 1e+30
for i in range(N - 2):
	ans = min(ans, fn(i))
print(ans)


n = int(input())
l = list(map(int, input().split()))
ans = 0
ll = []
lll = []
for i in range(n - 1):
	ans = max(ans, l[i + 1] - l[i])
anss = -1
for i in range(1, n - 1):
	if anss == -1:
		anss = l[i + 1] - l[i - 1]
	anss = min(anss, l[i + 1] - l[i - 1])
print(max(ans, anss))


n = int(input())
l = list(map(int, input().split()))
z = []
t = []
for i in range(n - 1):
	z.append(abs(l[i] - l[i + 1]))
for i in range(n - 2):
	t.append(abs(l[i] - l[i + 2]))
print(max(max(z), min(t)))


import math

def mindif(n, a):
	v = []
	w = 0
	for i in range(1, n - 1):
		temp = a.pop(i)
		x = []
		for j in range(n - 2):
			x.append(a[j + 1] - a[j])
		v.append(max(x))
		a.insert(i, temp)
	return abs(min(v))
n = int(input().strip())
a = input().strip().split()
a = list(map(int, a))
print(mindif(n, a))


N = int(input())
A = [int(n) for n in input().split()]
C = []
mem = []
for i in range(N - 2):
	C.append(A[i + 2] - A[i])
f = C.index(min(C))
del A[f + 1]
for i in range(N - 2):
	mem.append(A[i + 1] - A[i])
print(max(mem))


n = int(input())
l = list(map(int, input().split()))
(y, z) = ([], [])
for i in range(1, n - 1):
	x = l[:]
	del x[i]
	for j in range(len(x) - 1):
		y.append(x[j + 1] - x[j])
	z.append(y)
	y = []
for i in range(len(z)):
	y.append(max(z[i]))
print(min(y))


num_hold = int(input())
hold = input()
holds = hold.split()
for i in range(0, num_hold):
	holds[i] = int(holds[i])
min_dif = holds[num_hold - 1] - holds[0]
max_dif = 0
for i in range(0, num_hold - 1):
	if holds[i + 1] - holds[i] > max_dif:
		max_dif = holds[i + 1] - holds[i]
for i in range(0, num_hold - 2):
	if holds[i + 2] - holds[i] < min_dif:
		min_dif = holds[i + 2] - holds[i]
if min_dif < max_dif:
	print(max_dif)
else:
	print(min_dif)


n = input()
heights = input()
a = []
new = []
differences = []

def max():
	maximum = new[1] - new[0]
	for i in range(1, int(n) - 2):
		if maximum < new[i + 1] - new[i]:
			maximum = new[i + 1] - new[i]
	return maximum
for i in range(int(n) - 1):
	a.append(int(heights[:heights.find(' ')]))
	heights = heights[heights.find(' ') + 1:]
a.append(int(heights))
for i in range(1, int(n) - 1):
	new = a[:i] + a[i + 1:]
	differences.append(max())
minimum = differences[0]
for i in range(1, int(n) - 2):
	if differences[i] < minimum:
		minimum = differences[i]
print(minimum)


n = int(input())
a = list(map(int, input().split()))
i = 0
z = a[2] - a[0]
y = a[1] - a[0]
while i < n - 2:
	z = min(z, a[i + 2] - a[i])
	y = max(y, a[i + 1] - a[i])
	i += 1
y = max(y, a[i + 1] - a[i])
print(max(z, y))


n = int(input())
a = [int(x) for x in input().split()]
ans = 100000
for i in range(1, n - 1):
	var = a[:i] + a[i + 1:]
	ans = min(ans, max([a - b for (a, b) in zip(var[1:], var[:-1])]))
print(ans)


n = input()
n = int(n)
x = [int(i) for i in input().split()]
i = 1
t = []
while i < n - 1:
	y = []
	for j in range(n):
		if not j == i:
			y.append(x[j])
	mi = 0
	for j in range(n - 2):
		if j == 0:
			mi = y[j + 1] - y[j]
		else:
			mi = max(mi, y[j + 1] - y[j])
	t.append(mi)
	i += 1
print(min(t))


def main():
	n = int(input())
	heights = [int(_) for _ in input().split()]
	current_difficulty = max((heights[i] - heights[i - 1] for i in range(1, n)))
	minimum_difficulty = min([max(current_difficulty, heights[i + 2] - heights[i]) for i in range(n - 2)])
	print(minimum_difficulty)
main()


n = int(input())
a = list(map(int, input().strip().split()))
m = 10 ** 10
for i in range(1, n - 1):
	count = 0
	diff = 0
	b = a[i]
	a.remove(a[i])
	for j in range(1, n - 1):
		diff = a[j] - a[j - 1]
		count = max(count, diff)
	m = min(m, count)
	a.insert(i, b)
print(m)


def geti():
	return map(int, input().split())
n = int(input())
a = list(geti())
bd = 0
t = 10000000000.0
for i in range(n - 1):
	if a[i + 1] - a[i] > bd:
		bd = a[i + 1] - a[i]
for i in range(n - 2):
	if a[i + 2] - a[i] < t:
		t = a[i + 2] - a[i]
print(max(bd, t))


n = int(input())
a = list(map(int, input().split()))
b = [0]
for i in range(1, n):
	b.append(a[i] - a[i - 1])
res = 1005
for i in range(1, n - 1):
	now = b[i + 1] + b[i]
	for j in range(1, n):
		if j != i and j != i + 1:
			now = max(b[j], now)
	res = min(now, res)
print(res)


n = int(input())
mat = list(map(int, input().split()))
x = [mat[i + 2] - mat[i] for i in range(n - 2)]
y = [mat[i + 1] - mat[i] for i in range(n - 1)]
x = min(x)
y = max(y)
print(max(x, y))


n = int(input())
a = list(map(int, input().split()))
(step, Max) = (0, 0)
tmp = []
final = []
for i in range(1, n - 1):
	tmp = a[0:i] + a[i + 1:n]
	Max = 0
	for j in range(len(tmp) - 1):
		step = tmp[j + 1] - tmp[j]
		Max = max(step, Max)
	final.append(Max)
print(min(final))


n = int(input())
x = list(map(int, input().split()))
y = x[1:-1]
mini = -1
memo = []
for a in range(len(y)):
	z = y.copy()
	z.pop(a)
	maxi = 0
	z.append(x[0])
	z.append(x[-1])
	z.sort()
	for b in range(len(y)):
		j = abs(z[b] - z[b + 1])
		if maxi < j:
			maxi = j
	memo.append(maxi)
print(min(memo))


n = int(input())
a = list(map(int, input().split()))
minmax = a[len(a) - 1] - a[0]
for i in range(1, n - 1):
	d = -1
	x = a[0]
	for j in range(n):
		if j != i:
			d = max(d, a[j] - x)
			x = a[j]
	if d < minmax:
		minmax = d
print(minmax)


n = int(input())
x = list(map(int, input().split()))
l = len(x)
c = 0
d = x[2] - x[0]
for i in range(1, l):
	c = max(x[i] - x[i - 1], c)
	if i >= 2:
		d = min(x[i] - x[i - 2], d)
print(max(c, d))


a = int(input())
b = list(map(int, input().split()))
ans = []
for i in range(1, a - 1):
	c = b[:i] + b[i + 1:]
	x = -1000000
	n = len(c)
	for i in range(0, n - 1):
		x = max(x, c[i + 1] - c[i])
	ans.append(x)
print(min(ans))


import sys
num = int(sys.stdin.readline())
data = [int(x) for x in sys.stdin.readline().split(' ')]
diff = []
maxl = 10000
for i in range(0, num - 1):
	diff.append(data[i + 1] - data[i])
difflen = len(diff)
for i in range(0, difflen - 1):
	maxd = diff[i] + diff[i + 1]
	for j in range(0, difflen):
		if not j == i and (not j == i + 1):
			maxd = max(maxd, diff[j])
	maxl = min(maxl, maxd)
print(maxl)


n = int(input(''))
s = input(' ')
l = s.split(' ')
l = list(map(int, l))
max2 = []
for i in range(1, n - 1):
	l1 = []
	l2 = []
	for j in range(n):
		if j != i:
			l1.append(l[j])
	for k in range(len(l1) - 1):
		l2.append(l1[k + 1] - l1[k])
	max1 = max(l2)
	max2.append(max1)
print(min(max2))


input()
lst = list(map(int, input().split()))
max_val = 0
min_val = float('inf')
for i in range(len(lst) - 2):
	max_val = max(lst[i + 1] - lst[i], max_val)
	min_val = min(lst[i + 2] - lst[i], min_val)
max_val = max(max_val, lst[len(lst) - 1] - lst[len(lst) - 2])
print(max(min_val, max_val))


n = int(input())
arr = list(map(int, input().split()))
l = []
for i in range(1, n - 1):
	x = arr.pop(i)
	d = []
	for j in range(len(arr) - 1):
		d.append(arr[j + 1] - arr[j])
	l.append(max(d))
	arr.append(x)
	arr.sort()
print(min(l))


a = int(input())
(list, list2, list3) = ([], [], [])
list = [int(x) for x in input().split()]
for i in range(a):
	(list1, list2) = ([], [])
	list1.extend(list)
	del list1[i]
	if i == 0 or i == a - 1:
		continue
	else:
		for j in range(len(list1)):
			try:
				d = list1[j + 1] - list1[j]
				list2.append(d)
			except:
				x = 1
	try:
		c = max(list2)
		list3.append(c)
	except:
		x = 2
try:
	print(min(list3))
except:
	x = 1


n = int(input())
arr = list(map(int, input().split()))
minofmax = 9283
for j in range(1, len(arr) - 1):
	a = arr.copy()
	a.pop(j)
	mx = 0
	for i in range(1, len(a)):
		mx = max(mx, abs(a[i] - a[i - 1]))
	minofmax = min(minofmax, mx)
print(minofmax)


n = int(input())
l = list(map(int, input().strip().split()))
d = []
for i in range(len(l) - 1):
	d.append(l[i + 1] - l[i])
ma = max(d)
det = []
for i in range(len(d) - 1):
	det.append(d[i] + d[i + 1])
m = min(det)
ind = det.index(m)
d[ind] = m
d.remove(d[ind + 1])
print(max(d))


n = int(input())
A = list(map(int, input().split()))
cD = 0
for i in range(1, len(A)):
	cD = max(cD, A[i] - A[i - 1])
nD = None
for i in range(1, len(A) - 1):
	if not nD:
		nD = A[i + 1] - A[i - 1]
	nD = min(nD, A[i + 1] - A[i - 1])
print(max(nD, cD))


n = int(input())
a = [int(x) for x in input().split()]
c = []
for i in range(1, n - 1):
	k = a[i]
	del a[i]
	l = []
	for j in range(1, len(a)):
		l.append(a[j] - a[j - 1])
	a.insert(i, k)
	c.append(max(l))
print(min(c))


n = int(input())
a = [int(i) for i in input().split()]
t = a[1] - a[0]
for i in range(1, n - 1):
	if a[i + 1] - a[i] > t:
		t = a[i + 1] - a[i]
p = []
for i in range(1, n - 1):
	z = a[i + 1] - a[i - 1]
	p.append(z)
print(max(min(p), t))


n = int(input())
a = list(map(int, input().split()))
mini = -2
for i in range(1, n):
	if a[i] - a[i - 1] > mini:
		mini = a[i] - a[i - 1]
mini_for_this = 9999999
for i in range(1, n - 1):
	ans = max(mini, a[i + 1] - a[i - 1])
	if ans < mini_for_this:
		mini_for_this = ans
print(mini_for_this)


def calMin(l):
	m = -2 ** 31
	for i in range(1, len(l)):
		m = max(m, l[i] - l[i - 1])
	return m
n = int(input())
l = list(map(int, input().split()))
res = 2 ** 31
for i in range(1, len(l) - 1):
	a = l.copy()
	a.pop(i)
	m = calMin(a)
	res = min(res, m)
print(res)


n = int(input())
line = str(input()).split()
line = [int(it) for it in line]
size = len(line) - 2
note = list()
for i in range(size):
	temp_line = line[:1 + i].copy()
	temp_line.extend(line[2 + i:])
	temp_note = list()
	for j in range(size):
		temp_note.append(temp_line[j + 1] - temp_line[j])
	note.append(max(temp_note))
print(min(note))


input()
nums = list(map(int, input().split()))
ans = 0
ans3 = float('inf')
for i in range(1, len(nums) - 1):
	s = nums[:i] + nums[i + 1:]
	ans = 0
	for j in range(len(s) - 1):
		ans = max(ans, s[j + 1] - s[j])
	ans3 = min(ans3, ans)
print(ans3)


T = map(int, input().split())
a = [int(i) for i in input().split(' ')]
diffa = 0
for i in range(len(a) - 1):
	if a[i + 1] - a[i] > diffa:
		diffa = a[i + 1] - a[i]
diffb = a[2] - a[0]
for i in range(len(a) - 2):
	if a[i + 2] - a[i] < diffb:
		diffb = a[i + 2] - a[i]
print(max(diffa, diffb))


n = input()
m = list(map(int, input().split()))

def findMax(a, size):
	max = 0
	for i in range(0, size - 1):
		if a[i + 1] - a[i] > max:
			max = a[i + 1] - a[i]
	return max
ans = 1000
for i in range(1, len(m) - 1):
	temp = m[i]
	m.pop(i)
	val = findMax(m, len(m))
	if val < ans:
		ans = val
	m.insert(i, temp)
print(ans)


n = int(input())
a = list(map(int, input().split()))
big_int = -1
big_int2 = a[n - 1] - a[0]
for i in range(n - 1):
	if a[i + 1] - a[i] > big_int:
		big_int = a[i + 1] - a[i]
for i in range(n - 2):
	if a[i + 2] - a[i] < big_int2:
		big_int2 = a[i + 2] - a[i]
print(max(big_int, big_int2))


n = int(input())
l = list(map(int, input().split()))
s = []
for i in range(n - 2):
	a = 1
	for j in range(n - 2):
		if j == i:
			if l[j + 2] - l[j] > a:
				a = l[j + 2] - l[j]
		elif j > i:
			if l[j + 2] - l[j + 1] > a:
				a = l[j + 2] - l[j + 1]
		elif l[j + 1] - l[j] > a:
			a = l[j + 1] - l[j]
	s.append(a)
print(min(s))


n = int(input())
a = list(map(int, input().split()))
o = 10 ** 10
for i in range(1, n - 1):
	ot = -10 ** 10
	b = []
	for j in range(n):
		if i != j:
			b.append(a[j])
	for j in range(n - 2):
		ot = max(ot, b[j + 1] - b[j])
	o = min(o, ot)
print(o)


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(1, n - 1):
	c = []
	for j in range(n - 1):
		if j == i:
			continue
		elif j + 1 == i:
			c.append(a[j + 2] - a[j])
		else:
			c.append(a[j + 1] - a[j])
	b.append(max(c))
print(min(b))


n = int(input())
a = [int(i) for i in input().split()]
b = [0] * (n - 1)
for i in range(n - 1):
	b[i] = a[i + 1] - a[i]
c = [0] * (n - 2)
for i in range(n - 2):
	c[i] = b[i + 1] + b[i]
print(max(max(b), min(c)))


n = int(input())
a = list(map(int, input().split()))
minm = 1000000
maxm = 0
for i in range(1, len(a) - 1):
	diff = a[i + 1] - a[i - 1]
	if diff < minm:
		minm = diff
for i in range(1, len(a)):
	d = a[i] - a[i - 1]
	if d > maxm:
		maxm = d
if len(a) == 3:
	print(a[2] - a[0])
else:
	print(max(minm, maxm))


n = int(input())
a = [int(i) for i in input().split()]
res_list = []
for i in range(1, len(a) - 1):
	sub = list(a)
	sub.pop(i)
	pos = 0
	dif_list = []
	while pos < len(sub) - 1:
		dif = 0
		dif = sub[pos + 1] - sub[pos]
		dif_list.append(dif)
		pos += 1
	res = max(dif_list)
	res_list.append(res)
res = min(res_list)
print(res)


input()
a = (*map(int, input().split()),)
print(max(max((y - x for (x, y) in zip(a, a[1:]))), min((z - x for (x, _, z) in zip(a, a[1:], a[2:])))))


n = int(input())
li = list(map(int, input().split()))
k = []
for i in range(1, n - 1):
	k1 = li + []
	k1.remove(li[i])
	f = []
	for j in range(0, len(k1) - 1):
		f.append(k1[j + 1] - k1[j])
	k.append(max(f))
print(min(k))


n = int(input())
ps = list(map(int, input().split()))
maxi = 0
for i in range(n - 1):
	maxi = max(maxi, ps[i + 1] - ps[i])
mini = 10 ** 10
for i in range(1, n - 1):
	mini = min(mini, ps[i + 1] - ps[i - 1])
print(max(maxi, mini))


input()
X = list(map(int, input().split()))
MIN = X[-1] - X[0]
for i in range(1, len(X) - 1):
	Y = X[:i] + X[i + 1:]
	MAX = Y[1] - Y[0]
	for j in range(len(Y)):
		MAX = max(MAX, Y[j] - Y[j - 1])
	MIN = min(MIN, MAX)
print(MIN)


def findmindiff(lst, ele):
	mst = lst.copy()
	mst.remove(ele)
	mindiff = 0
	i = 0
	if len(mst) == 2:
		return mst[-1] - mst[0]
	else:
		while i < len(mst) - 1:
			if mst[i + 1] - mst[i] > mindiff:
				mindiff = mst[i + 1] - mst[i]
				i += 1
			else:
				i += 1
	return mindiff
n = int(input())
lst = list(map(int, input().split()))
diff = []
i = 1
while i < len(lst) - 1:
	diff.append(findmindiff(lst, lst[i]))
	i += 1
print(min(diff))


n = int(input())
a = [int(x) for x in input().split()]
smallest = a[2] - a[0]
for i in range(1, n - 2):
	if a[i + 2] - a[i] < smallest:
		smallest = a[i + 2] - a[i]
largest = 0
for i in range(n - 1):
	if a[i + 1] - a[i] > largest:
		largest = a[i + 1] - a[i]
if largest > smallest:
	smallest = largest
print(smallest)


n = int(input())
l = list(map(int, input().split()))
mi = 1000000
P = 0
for i in range(n - 2):
	if abs(l[i] - l[i + 2]) < mi:
		mi = abs(l[i] - l[i + 2])
		p = i + 1
l[p] = 0
ma = 0
for i in range(n - 1):
	if l[i + 1] == 0 and l[i] != 0:
		if ma < l[i + 2] - l[i]:
			ma = l[i + 2] - l[i]
	if l[i + 1] != 0 and l[i] != 0:
		if ma < l[i + 1] - l[i]:
			ma = l[i + 1] - l[i]
print(ma)


n = int(input())
a = list(map(int, input().split()))
if n == 3:
	print(a[2] - a[0])
else:
	x = max([a[i + 1] - a[i] for i in range(n - 1)])
	y = min([a[x + 2] - a[x] for x in range(n - 2)])
	print(max(x, y))


x = int(input())
a = list(map(int, input().split()))
if x == 3:
	print(a[-1] - a[0])
else:
	t = []
	k = []
	for i in range(1, x):
		r = a[i] - a[i - 1]
		t.append(r)
	for i in range(1, len(t)):
		r = t[i] + t[i - 1]
		k.append(r)
	if t.count(r) == len(t):
		print(2 * r)
	else:
		r = min(k)
		c = k.index(r)
		t[c + 1] = t[c] + t[c + 1]
		t.pop(c)
		print(max(t))


n = int(input())
h = [int(x) for x in input().split()]
diff = []
for i in range(n - 1):
	diff.append(h[i + 1] - h[i])
md = max(diff)
sd = diff[0] + diff[1]
for i in range(1, n - 1):
	if diff[i] + diff[i - 1] < sd:
		sd = diff[i] + diff[i - 1]
print(max(md, sd))


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


n = int(input())
l = list(map(int, input().split()))
nr = [1001] * n
r = [1001] * n
nr[1] = l[1] - l[0]
nr[2] = max(l[2] - l[1], l[1] - l[0])
r[1] = l[2] - l[0]
for i in range(3, n):
	nr[i] = max(nr[i - 1], l[i] - l[i - 1])
	r[i - 1] = min(max(nr[i - 2], l[i] - l[i - 2]), max(r[i - 2], l[i] - l[i - 1]))
print(r[n - 2])


n = int(input())
a = [int(i) for i in input().split()]
y = 0
for i in range(1, n - 1):
	b = a[:]
	b.pop(i)
	x = 0
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] > x:
			x = b[i + 1] - b[i]
	if x < y or y == 0:
		y = x
print(y)


n = int(input())
m = []
arr = [int(i) for i in input().split()]
for i in range(1, n - 1):
	l = []
	j = 0
	while j != n - 1:
		if j + 1 == i:
			l.append(arr[i + 1] - arr[j])
			j = j + 2
		else:
			l.append(arr[j + 1] - arr[j])
			j = j + 1
	m.append(max(l))
print(min(m))


def diff(n):
	dif = 0
	for i in range(len(n) - 1):
		if dif < n[i + 1] - n[i]:
			dif = n[i + 1] - n[i]
	return dif
n = int(input())
holes = list(map(int, input().split()))
tmp = []
min_dif = 9999
for i in range(1, len(holes) - 1):
	for j in holes:
		if holes[i] == j:
			continue
		else:
			tmp.append(j)
	k = diff(tmp)
	if min_dif > k:
		min_dif = k
	tmp = []
print(min_dif)


R = lambda : map(int, input().split())
(n,) = R()
a = list(R())
print(max([min([a[i + 2] - a[i] for i in range(n - 2)])] + [a[i + 1] - a[i] for i in range(n - 1)]))


n = int(input())
steps = [int(i) for i in input().split()]
(s1, s2) = (iter(steps), iter(steps))
next(s2)
diffs = [j - i for (i, j) in zip(s1, s2)]
if len(diffs) == 2:
	print(diffs[0] + diffs[1])
else:
	min_diff = 1000000
	for i in range(0, len(diffs) - 1):
		diff = max(*diffs[0:i], diffs[i] + diffs[i + 1], *diffs[i + 1:])
		min_diff = min(diff, min_diff)
	print(min_diff)


n = int(input())
l = input().split()
for i in range(n):
	l[i] = int(l[i])
k = []
for i in range(n - 1):
	k.append(l[i + 1] - l[i])
k1 = max(k)
m = []
for i in range(n - 2):
	m.append(l[i + 2] - l[i])
m1 = min(m)
if m1 > k1:
	print(m1)
else:
	print(k1)


import sys
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
mini = Arr[2] - Arr[0]
for i in range(1, n - 2):
	mini = min(mini, Arr[i + 2] - Arr[i])
maxi = Arr[1] - Arr[0]
for i in range(1, n):
	maxi = max(maxi, Arr[i] - Arr[i - 1])
print(max(maxi, mini))


n = int(input())
a = list(map(int, input().split()))
max_a = max((a[i + 1] - a[i] for i in range(n - 1)))
min_a = min((a[i + 2] - a[i] for i in range(n - 2)))
print(max(max_a, min_a))


n = int(input())
a = list(map(int, input().split()))
m = 1000000000.0
for i in range(1, n - 1):
	b = a[:i] + a[i + 1:]
	mm = -1
	for j in range(n - 2):
		mm = max(mm, b[j + 1] - b[j])
	m = min(m, mm)
print(m)


n = int(input())
a = list(map(int, input().split()))
q = 1 << 32
p = []
for i in range(n - 1):
	p.append(a[i + 1] - a[i])
for i in range(1, n - 1):
	q = min(q, a[i + 1] - a[i - 1])
print(max(max(p), q))


a = int(input())
l = list(map(int, input().split(' ')))
l1 = []
l2 = []
for i in range(1, a - 1):
	b = l.pop(i)
	for j in range(0, len(l) - 1):
		c = l[j + 1] - l[j]
		l1.append(c)
	d = max(l1)
	l.insert(i, b)
	l2.append(d)
	l1 = [0] * 1000
print(min(l2))


n = int(input())
a = [int(x) for x in input().split()]
pmax = max((a[i + 1] - a[i] for i in range(n - 1)))
print(min((max(a[i + 1] - a[i - 1], pmax) for i in range(1, n - 1))))


n = int(input())
a = [int(x) for x in input().split()]
b = []
d = []
if n == 3:
	print(abs(a[0] - a[2]))
else:
	for i in range(1, n - 1):
		b = a[:i] + a[i + 1:]
		c = [x - b[i - 1] for (i, x) in enumerate(b)][1:]
		d.append(max(c))
	print(min(d))


n = int(input())
mat = list(map(int, input().split()))
sat = []
dat = []
for i in range(1, n - 1):
	sat.append(mat[i + 1] - mat[i - 1])
	dat.append(mat[i] - mat[i - 1])
dat.append(mat[i + 1] - mat[i])
dat[sat.index(min(sat))] = min(sat)
dat[sat.index(min(sat)) + 1] = -1
print(max(dat))


n = int(input())
l = list(map(int, input().split()))
a = []
m = []
for i in range(1, n):
	a.append(l[i] - l[i - 1])
for i in range(1, n - 1):
	x = max(max(a), a[i] + a[i - 1])
	m.append(x)
print(min(m))


n = int(input())
l = list(map(int, input().split()))

def find_ans(l):
	m = 0
	for i in range(1, len(l)):
		d = l[i] - l[i - 1]
		m = max(m, d)
	return m
t = l
f_ans = 100000000000000000000000000000000
for i in range(1, n - 1):
	temp = l[0:i] + l[i + 1:n]
	ans = find_ans(temp)
	f_ans = min(f_ans, ans)
print(f_ans)


n = int(input())
l = list(map(int, input().split()))
min = 999

def get_max_difference(x: list):
	x_len = len(x)
	max = 0
	for i in range(x_len - 1):
		dif = x[i + 1] - x[i]
		if dif > max:
			max = dif
	return max
for i in range(1, n - 1):
	x = get_max_difference(l[:i] + l[i + 1:])
	if x < min:
		min = x
print(min)


a = int(input())
l = input().split()
z = len(l)
s = []
k = []
for i in range(1, len(l) - 1):
	v = l[i]
	del l[i]
	for j in range(z - 2):
		p = int(l[j + 1]) - int(l[j])
		s.append(p)
	w = max(s)
	s.clear()
	k.append(w)
	l.append(v)
	l.sort()
h = min(k)
print(h)


import copy
n = int(input())
s = input()
s = s.split()
mylist = []
for i in range(len(s)):
	s[i] = int(s[i])
for i in range(len(s)):
	newlist = []
	n = copy.deepcopy(s)
	if i == 0 or i == len(s) - 1:
		continue
	n.remove(s[i])
	n.sort()
	for j in range(len(n) - 1):
		newlist.append(n[j + 1] - n[j])
	mylist.append(max(newlist))
print(min(mylist))


(a, A) = (int(input()), list(map(int, input().split())))
print(max(min((A[i + 2] - A[i] for i in range(a - 2))), max((A[i + 1] - A[i] for i in range(a - 1)))))


n = int(input())
mas_vsi = list(map(int, input().split(' ')))

def mas_ras(mv):
	mas_r = []
	for i in range(len(mv)):
		mas_r.append(mv[i] - mv[i - 1])
	return mas_r

def opred_min_uvelich(mas_rznst):
	mas_rznst = mas_rznst[1:]
	if len(mas_rznst) < 2:
		return mas_rznst[0]
	t = mas_rznst[0] + mas_rznst[1]
	m = max(mas_rznst)
	for i in range(len(mas_rznst) - 1):
		if mas_rznst[i] + mas_rznst[i + 1] < t:
			t = mas_rznst[i] + mas_rznst[i + 1]
		elif mas_rznst[i] + mas_rznst[i + 1] < m:
			return m
	return t
print(opred_min_uvelich(mas_ras(mas_vsi)))


n = int(input())
t = list(map(int, input().split()))
y = []
for k in range(n - 1):
	y.append(t[k + 1] - t[k])
p = []
for j in range(n - 2):
	o = t[j + 2] - t[j]
	u = y[0:j] + y[j + 2:] + [o]
	p.append(max(u))
print(min(p))


n = int(input())
a = list(map(int, input().split()))
y = []
for i in range(1, n - 1):
	l = list(a)
	l.remove(a[i])
	x = [l[i + 1] - l[i] for i in range(len(l) - 1)]
	y.append(max(x))
print(min(y))


input()
t = [int(x) for x in input().split()]
n = len(t) - 1
temp = 1000000000
for i in range(1, n):
	temp2 = 0
	for j in range(n):
		if j + 1 == i:
			temp2 = max(temp2, t[j + 2] - t[j])
		elif i != j:
			temp2 = max(temp2, t[j + 1] - t[j])
	temp = min(temp, temp2)
print(temp)


n = int(input())
L = list(map(int, input().split()))
D = [L[i] - L[i - 1] for i in range(1, n)]
m = max(D)
e = 10 ** 5
for i in range(1, n - 1):
	e = min(e, max(m, D[i] + D[i - 1]))
print(e)


n = int(input())
holds = []
temp1 = input()
temp2 = temp1.split(' ')
for i in range(n):
	holds.append(int(temp2[i]))
if n == 3:
	min = holds[2] - holds[0]
	print(min)
else:
	min = 99999
	for i in range(1, n - 1):
		t = holds[i]
		holds.pop(i)
		max = 0
		for a in range(n - 2):
			diff = holds[a + 1] - holds[a]
			if diff > max:
				max = diff
		if min > max:
			min = max
		holds.insert(i, t)
	print(min)


n = int(input())
l = list(map(int, input().split()))
m = []
for x in range(n - 2):
	li = [l[0]] + [y for (i, y) in enumerate(l) if i not in (0, n - 1, x + 1)] + l[-1:]
	m.append(max((li[_ + 1] - li[_] for _ in range(n - 2))))
print(min(m))


n = int(input())
list1 = list(map(int, input().split()))
list2 = []
for i in range(n - 1):
	list2.append(abs(list1[i] - list1[i + 1]))
x = max(list2)
m = 100000
for i in range(len(list2) - 1):
	s = list2[i] + list2[i + 1]
	if s < m:
		m = s
print(max(x, m))


n = int(input())
a = list(map(int, input().split()))
res = []
for i in range(n - 1):
	res.append(a[i + 1] - a[i])
i = 1
min_val = 999999
ans = []
while i < n - 1:
	temp = res[:i - 1]
	temp.append(res[i - 1] + res[i])
	temp.extend(res[i + 1:])
	ans.append(max(temp))
	i += 1
min_val = min(ans)
print(min_val)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
a = list(map(int, input().split()))
E = 0
p = 10 ** 4
for i in range(n - 1):
	E = max(E, a[i + 1] - a[i])
for i in range(n - 2):
	p = min(p, a[i + 2] - a[i])
print(max(E, p))


from itertools import tee

def pairwise_apart(ais):
	(ais1, ais2) = tee(ais)
	next(ais2, 999999)
	next(ais2, 999999)
	return zip(ais1, ais2)

def pairwise(ais):
	(ais1, ais2) = tee(ais)
	next(ais2, 999999)
	return zip(ais1, ais2)

def diff(ns):
	return ns[1] - ns[0]

def main(ais):
	diffs_after = [diff(ns) for ns in pairwise_apart(ais)]
	diffs_before = [diff(ns) for ns in pairwise(ais)]
	ans = max(min(diffs_after), max(diffs_before))
	print(ans)
input()
main([int(x) for x in input().split(' ')])


n = int(input())
x = [int(x) for x in input().split()]

def func(x):
	arr = []
	s = 0
	for i in range(1, len(x)):
		s = x[i] - x[i - 1]
		arr.append(s)
	return max(arr)
k = 100000000
for i in range(1, n - 1):
	a = x.copy()
	a.remove(a[i])
	ans = func(a)
	if ans < k:
		k = ans
print(k)


n = int(input())
a = list(map(int, input().split()))
h = []
for i in range(1, n - 1):
	b = a.copy()
	b.remove(a[i])
	m = min(b) - max(b)
	for i in range(n - 2):
		m = max(m, abs(b[i] - b[i + 1]))
	h.append(m)
print(min(h))


n = int(input())
a = list(map(int, input().split()))
s = []
d = []
for i in range(1, n - 1):
	x = a.copy()
	del x[i]
	s.append(x)
for i in range(0, len(s)):
	x = []
	for j in range(0, len(s[i]) - 1):
		x.append(s[i][j + 1] - s[i][j])
	d.append(max(x))
print(min(d))


n = int(input())
mas = list(map(int, input().split(' ')))
ma = 0
mi = 999999999999
for i in range(1, n - 1):
	ma = max(ma, abs(mas[i] - mas[i - 1]), abs(mas[i] - mas[i + 1]))
	mi = min(mi, abs(mas[i + 1] - mas[i - 1]))
print(max(mi, ma))


import math
n = int(input())
a = list(map(int, input().split()))
min1 = math.inf
index1 = 1
for index in range(2, len(a) - 1):
	if a[index] - a[index - 1] < min1:
		min1 = a[index] - a[index - 1]
		if a[index] - a[index - 2] < a[index + 1] - a[index - 1]:
			index1 = index - 1
		else:
			index1 = index
a.remove(a[index1])
max1 = -math.inf
for index in range(1, len(a)):
	if a[index] - a[index - 1] > max1:
		max1 = a[index] - a[index - 1]
print(max1)


import sys
nu = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
r = max(a)
for j in range(1, nu - 1):
	x = 0
	b = a[:]
	b.remove(a[j])
	for i in range(0, nu - 2):
		x = max(x, b[i + 1] - b[i])
	r = min(r, x)
print(r)


n = int(input())
a = list(map(int, input().split()))
ans = 10 ** 10
for i in range(1, n - 1):
	cur = a[:i] + a[i + 1:]
	ans = min(ans, max((cur[j] - cur[j - 1] for j in range(1, len(cur)))))
print(ans)


n = int(input())
a = input().split(' ')
b = []
for i in range(n):
	a[i] = int(a[i])
	b.append(a[i])
max = 0
max1 = []
for i in range(1, n - 1):
	del b[i]
	max = 0
	for j in range(len(b) - 1):
		if b[j + 1] - b[j] > max:
			max = b[j + 1] - b[j]
	max1.append(max)
	b = list.copy(a)
print(min(max1))


n = int(input())
nums = list(map(int, input().split()))

def difficulty(nums):
	diff = None
	for i in range(1, len(nums)):
		diff2 = nums[i] - nums[i - 1]
		if not diff or diff2 > diff:
			diff = diff2
	return diff
min_diff = None
for i in range(1, len(nums) - 1):
	nums2 = list(nums)
	nums2.pop(i)
	diff = difficulty(nums2)
	if not min_diff or diff < min_diff:
		min_diff = diff
print(min_diff)


n = int(input())
a = list(map(int, input().split()))
minm = 10000000
maxm = 0
for i in range(1, len(a) - 1):
	diff = a[i + 1] - a[i - 1]
	if diff < minm:
		minm = diff
for i in range(1, len(a)):
	d = a[i] - a[i - 1]
	if d > maxm:
		maxm = d
print(max(minm, maxm))


nbHolds = int(input(''))
holds = input('').split(' ')
max_1 = 0
min_2 = 1001
for loop in range(nbHolds - 1):
	max_1 = max(max_1, int(holds[loop + 1]) - int(holds[loop]))
for loop in range(nbHolds - 2):
	min_2 = min(min_2, int(holds[loop + 2]) - int(holds[loop]))
print(max(max_1, min_2))


n = int(input())
a = list(map(int, input().split()))
ans = 20000
for i in range(1, n - 1):
	z = a[:i] + a[i + 1:]
	ak = -1
	for j in range(1, n - 1):
		ak = max(ak, z[j] - z[j - 1])
	ans = min(ans, ak)
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
m = []
f = [l[i] - l[i - 1] for i in range(1, n)]
for i in range(1, n - 1):
	m.append(max(l[i + 1] - l[i - 1], max(f)))
print(min(m))


n = int(input())
d = input()
d = [int(d) for d in d.split()]
m1 = -1
m = 10000000000
for i in range(0, n - 1):
	if d[i + 1] - d[i] > m1:
		m1 = d[i + 1] - d[i]
for i in range(1, n - 1):
	if d[i + 1] - d[i - 1] < m:
		m = d[i + 1] - d[i - 1]
print(max(m, m1))


n = int(input())
holds = [int(x) for x in input().split()]
minDiff = 1001
currentDiff = 0
diffs = []
for i in range(1, n):
	diff = holds[i] - holds[i - 1]
	if diff > currentDiff:
		currentDiff = diff
for i in range(1, n - 1):
	diff = holds[i + 1] - holds[i - 1]
	if diff < currentDiff:
		print(currentDiff)
		exit()
	if diff >= currentDiff:
		diffs.append(diff)
print(min(diffs))


def difficulty(l):
	max_d = l[1] - l[0]
	for i in range(1, len(l) - 1):
		if l[i + 1] - l[i] > max_d:
			max_d = l[i + 1] - l[i]
	return max_d
n = int(input())
a = list(map(int, input().split()))
i = 1
fin = n - 2
min_d = []
while i <= n - 2:
	min_d.append(difficulty(a[:i] + a[i + 1:]))
	i += 1
print(min(min_d))


n = int(input())
a = list(map(int, input().split()))
max_ = -1
for i in range(len(a) - 1):
	if a[i + 1] - a[i] > max_:
		max_ = a[i + 1] - a[i]
min_ = 100000
for i in range(1, len(a) - 1):
	max_a = max_
	if a[i + 1] - a[i - 1] > max_a:
		max_a = a[i + 1] - a[i - 1]
	if max_a < min_:
		min_ = max_a
print(min_)


num_clues = int(input())
numbers = input().split()
numbers = [int(i) for i in numbers]
output = []
for i in range(1, num_clues - 1):
	new_list = numbers[:i] + numbers[i + 1:]
	output.append(max([new_list[x] - new_list[x - 1] for x in range(num_clues - 2, 0, -1)]))
print(min(output))


n = int(input())
a = list(map(int, input().split()))
result = []
for i in range(1, n - 1):
	x = a.pop(i)
	y = a
	result.append(max((y[i + 1] - y[i] for i in range(len(y) - 1))))
	a.insert(i, x)
print(min(result))


n = int(input())
a = []
a = input().split()
for i in range(0, n):
	a[i] = int(a[i])
md = []
c = []
for i in range(1, n - 1):
	diff = []
	c = a.copy()
	c.pop(i)
	for j in range(0, len(c) - 1):
		d = c[j + 1] - c[j]
		diff.append(d)
	md.append(max(diff))
print(min(md))


n = int(input())
s = [int(i) for i in input().split(' ')]

def check(a):
	n = len(a)
	ans = 0
	for i in range(n - 1):
		ans = ans if ans > a[i + 1] - a[i] else a[i + 1] - a[i]
	return ans
ans = 1 << 30
for i in range(1, n - 1):
	v = check(s[0:i] + s[i + 1:n])
	ans = ans if ans < v else v
print(ans)


n = int(input(''))
ar = list(map(int, input('').split()))
l = []
for i in range(len(ar) - 2):
	l.append(ar[i + 2] - ar[i])
l1 = min(l)
q = []
for i in range(len(ar) - 1):
	q.append(ar[i + 1] - ar[i])
l2 = max(q)
if l1 <= l2:
	print(l2)
else:
	print(l1)


n = int(input())
a = list(map(int, input().split()))
result = 1001
for i in range(n - 2):
	if a[i + 2] - a[i] < result:
		result = a[i + 2] - a[i]
for i in range(n - 1):
	result = max(result, a[i + 1] - a[i])
print(result)


n = int(input())
array = list(map(int, input().split()))
a = []
b = []
c = 0
for i in range(1, n - 1):
	p = array.pop(i)
	for j in range(n - 2):
		d = abs(array[j] - array[j + 1])
		a.append(d)
	b.append(max(a))
	a.clear()
	array.insert(i, p)
print(min(b))


import copy as cp
n = int(input())
a = [int(i) for i in input().split()]
b = []
res = []
for i in range(n):
	res.append(cp.copy(a))
for i in range(1, n - 1):
	res[i].pop(i)
mini = [[0 for j in range(n - 2)] for i in range(n - 2)]
for i in range(1, n - 1):
	for j in range(0, n - 2):
		mini[i - 1][j] = abs(res[i][j] - res[i][j + 1])
for elem in mini:
	elem.sort()
Min = mini[0][n - 3]
for i in range(1, n - 2):
	if mini[i][n - 3] < Min:
		Min = mini[i][n - 3]
print(Min)


input()
m = list(map(int, input().split()))
anw = 0
d = 1000000000.0
for i in range(len(m) - 1):
	anw = max(anw, abs(m[i] - m[i + 1]))
for i in range(1, len(m) - 1):
	d = min(d, abs(m[i - 1] - m[i + 1]))
print(max(d, anw))


holds = int(input())
pos = input()
pos = pos.split()
pos = [int(x) for x in pos]
maximum = 0
min_in_max = []
a = 0
if pos == 3:
	print(pos[2] - pos[0])
else:
	for x in range(1, holds - 1):
		a = pos.pop(x)
		maximum = 0
		for y in range(1, holds - 1):
			if pos[y] - pos[y - 1] > maximum:
				maximum = pos[y] - pos[y - 1]
		min_in_max.append(maximum)
		pos.insert(x, a)
min_in_max.sort()
print(min_in_max[0])


n = int(input())
l = list(map(int, input().split()))
mini = float('inf')
toremove = -1
for i in range(1, n - 1):
	if l[i] - l[i - 1] + (l[i + 1] - l[i]) < mini:
		mini = l[i] - l[i - 1] + (l[i + 1] - l[i])
		toremove = i
l.pop(toremove)
maxi = float('-inf')
for i in range(n - 2):
	if l[i + 1] - l[i] > maxi:
		maxi = l[i + 1] - l[i]
print(maxi)


from itertools import combinations
n = int(input())
a = list(map(int, input().split()))
b = list(combinations(a, n - 1))
s = []
c = []
for val in b:
	if val[0] == a[0] and val[-1] == a[-1]:
		c.append(val)
for val in c:
	f = 0
	for i in range(len(val) - 1):
		if f == 0:
			diff = val[i + 1] - val[i]
			f = 1
		if f == 1 and val[i + 1] - val[i] > diff:
			diff = val[i + 1] - val[i]
	s.append(diff)
print(min(s))


n = int(input())
a = list(map(int, input().split()))
m = -1
for i in range(n - 1):
	c = a[i + 1] - a[i]
	if c > m:
		m = c
m2 = 1000000000
for i in range(1, n - 1):
	if a[i + 1] - a[i - 1] < m2:
		m2 = a[i + 1] - a[i - 1]
print(max(m, m2))


n = int(input())
a = [int(i) for i in input().split(' ')]
c = [a[i] - a[i - 2] for i in range(2, len(a))]
a.pop(c.index(min(c)) + 1)
c = [a[i] - a[i - 1] for i in range(1, len(a))]
print(str(max(c)))


n = int(input())
lst = list(map(int, input().split()))
result_2 = []
for i in range(len(lst)):
	lst_2 = []
	lst_2.extend(lst)
	result_1 = []
	if lst[i] != lst[-1] and i != 0:
		lst_2.remove(lst[i])
		for elem in range(len(lst_2) - 1):
			result_1.append(lst_2[elem + 1] - lst_2[elem])
		result_2.append(max(result_1))
print(min(result_2))


n = int(input())
a = [int(x) for x in input().split()]
val = []
mv = 0
for i in range(1, n):
	mv = max(mv, a[i] - a[i - 1])
z = 1000
for i in range(1, n - 1):
	z = min(z, a[i + 1] - a[i - 1])
if z <= mv:
	print(mv)
else:
	print(z)


n = int(input())
x = list(map(int, input().split()))
y = []
for i in range(1, n):
	y.append(x[i] - x[i - 1])
z = []
for i in range(n - 2):
	z.append(y[i] + y[i + 1])
tans = max(y)
ans = []
for i in z:
	if i >= tans:
		ans.append(i)
	else:
		ans.append(tans)
print(min(ans))


n = int(input())
x = [int(item) for item in input().split()]
checklist = []
for item in range(1, n):
	checklist.append(x[item] - x[item - 1])
D = max(checklist)
anslist = []
for item in range(1, n - 1):
	if x[item + 1] - x[item - 1] > D:
		anslist.append(x[item + 1] - x[item - 1])
	else:
		pass
if len(anslist) == n - 2:
	print(min(anslist))
else:
	print(D)


import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
A = max([a[i + 1] - a[i] for i in range(n - 1)])
B = a[-1] - a[0]
for i in range(1, n - 1):
	B = min(B, a[i + 1] - a[i - 1])
	if B <= A:
		print(A)
		break
else:
	print(B)


n = int(input())
line = input().split()
lst = []
for num in line:
	lst.append(int(num))
ans = lst[1] - lst[0]
mn = lst[2] - lst[0]
for i in range(2, n):
	ans = max(ans, lst[i] - lst[i - 1])
	mn = min(mn, lst[i] - lst[i - 2])
ans = max(ans, mn)
print(str(ans))


n = int(input())
a = list(map(int, input().split()))
ans = 100000
diff = 0
for i in range(n):
	if i > 0:
		tp = a[i] - a[i - 1]
		if tp > diff:
			diff = tp
	if i > 1:
		temp = a[i] - a[i - 2]
		if temp < ans:
			ans = temp
if ans > diff:
	print(ans)
else:
	print(diff)


n = int(input())
a = list(map(int, input().split()))
d = 0
for i in range(1, n):
	d = max(d, a[i] - a[i - 1])
ans = 100000.0
for i in range(2, n):
	newd = max(d, a[i] - a[i - 2])
	ans = min(newd, ans)
print(ans)


n = int(input())
l = list(map(int, input().rstrip().split()))
mi = 1000
d = max([l[i] - l[i - 1] for i in range(1, n)])
for i in range(2, n):
	if max(l[i] - l[i - 2], d) < mi:
		mi = max(l[i] - l[i - 2], d)
print(mi)


n = int(input())
k = list(map(int, input().split()))
l = len(k)
u = k.copy()
p = 0
for i in range(l - 2):
	max = 0
	if i != l - 2:
		k.pop(i + 1)
	for j in range(len(k) - 1):
		z = k[j + 1] - k[j]
		if z > max:
			max = z
	if p == 0:
		min = max
	elif max < min:
		min = max
	p += 1
	k = u.copy()
print(min)


n = int(input())
a = list(map(int, input().split()))
diffA = [j - i for (i, j) in zip(a[:-1], a[1:])]
ans = max(diffA)
res = 1000
for i in range(1, n - 1):
	res = min(res, max(a[i + 1] - a[i - 1], ans))
print(res)


n = int(input())
r = list(map(int, input().split()))
c = 0
z = []
for y in range(1, n - 1):
	k = r[:y] + r[y + 1:]
	for x in range(n - 2):
		j = k[x + 1] - k[x]
		if j > c:
			c = j
	z.append(c)
	c = 0
print(min(z))


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(2, len(a), 1):
	b.append(a[i] - a[i - 2])
k = b.index(min(b))
del a[k + 1]
anss = []
for i in range(1, n - 1):
	anss.append(a[i] - a[i - 1])
print(max(anss))


n = int(input())
L = list(map(int, input().split()))
i = 0
k = 1
j = 2
mini = L[j] - L[i]
while j < n:
	if L[j] - L[i] < mini:
		mini = L[j] - L[i]
		k = (i + j) // 2
	i += 1
	j += 1
L = L[:k] + L[k + 1:]
i = 0
j = 1
ans = 0
while j < n - 1:
	ans = max(ans, L[j] - L[i])
	j += 1
	i += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
minm = a[-1] - a[0]
maxm = a[1] - a[0]
for i in range(1, n - 1):
	minm = min(a[i + 1] - a[i - 1], minm)
	maxm = max(a[i] - a[i - 1], maxm)
maxm = max(a[-1] - a[-2], maxm)
print(max(maxm, minm))


p = int(input(''))
arr = list(map(int, input().split()))
m = -1
n = 100000
for i in range(1, p - 1):
	m = -1
	for j in range(0, p - 1):
		if j == i:
			continue
		if j + 1 == i:
			a = arr[j + 2] - arr[j]
		else:
			a = arr[j + 1] - arr[j]
		if a > m:
			m = a
	if m < n:
		n = m
print(n)


n = int(input())
string = input()
heights = string.split(' ')
for x in range(n):
	heights[x] = int(heights[x])
difficulties = []
for x in range(1, n - 1):
	temp = heights[:]
	del temp[x]
	distances = []
	for y in range(n - 2):
		distances.append(temp[y + 1] - temp[y])
	difficulties.append(max(distances))
print(min(difficulties))


n = int(input())
a = list(map(int, input().split()))
c = list(range(n - 1))
i = 1
f = max(a) + 1
b = 0
while i < n - 1:
	j = 0
	while j < n - 1:
		if j < i:
			c[j] = a[j]
		else:
			c[j] = a[j + 1]
		j += 1
	j = 0
	while j < n - 2:
		if c[j + 1] - c[j] > b:
			b = c[j + 1] - c[j]
		j += 1
	if b < f:
		f = b
	b = 0
	i += 1
print(f)


n = int(input())
arr = list(map(int, input().split()))
t = arr.copy()
min = 1000
for i in range(n - 2):
	max = 0
	arr.remove(arr[i + 1])
	j = 0
	while j < n - 2:
		c = arr[j + 1] - arr[j]
		if c > max:
			max = c
		j += 1
	arr = t.copy()
	if max < min:
		min = max
print(min)


n = int(input())
A = [int(i) for i in input().split()]
d = []
for i in range(1, n - 1):
	Ap = A[:]
	Ap.pop(i)
	di = []
	for j in range(n - 2):
		di.append(Ap[j + 1] - Ap[j])
	d.append(max(di))
print(min(d))


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
n = int(input())
l = RI()
ans = 0
for i in range(n - 1):
	ans = max(ans, l[i + 1] - l[i])
orig = ans
k = []
for i in range(1, n - 1):
	temp = 0
	for j in range(n - 1):
		if j != i and j + 1 != i:
			temp = max(temp, l[j + 1] - l[j])
		elif j + 1 == i:
			if j != n - 2:
				temp = max(temp, l[j + 2] - l[j])
		elif j == i:
			continue
	if temp >= orig:
		k.append(temp)
print(min(k))


n = int(input())
a = list(map(int, input().split()))
if n == 3:
	print(a[-1] - a[0])
else:
	ans = 1000
	for i in range(1, n - 1):
		res = 1
		for j in range(1, n - 1):
			res = max(res, a[j + 1] - [a[j], a[j - 1]][j == i])
		ans = min(ans, res)
	print(ans)


n = int(input())
a = list(map(int, input().split()))
z = []
m = []
for i in range(1, n - 1):
	z = []
	k = a[:i] + a[i + 1:]
	for i in range(1, len(k)):
		z.append(k[i] - k[i - 1])
	m.append(max(z))
print(min(m))


def solve(at, n, arr):
	ans = float('-inf')
	i = 0
	while i < n - 1:
		if i + 1 == at and i <= n - 2:
			ans = max(ans, arr[at + 1] - arr[i])
			i = i + 2
		else:
			ans = max(ans, arr[i + 1] - arr[i])
			i = i + 1
	return ans
n = int(input())
arr = list(map(int, input().split()))
if n == 3:
	print(arr[-1] - arr[0])
else:
	result = float('inf')
	for at in range(1, n - 1):
		result = min(result, solve(at, n, arr))
	print(result)


x = int(input())
l = list(map(int, input().split()))
if x == 3:
	print(l[-1] - l[0])
else:
	list = []
	k = []
	for tt in l[1:-2]:
		for num in range(1, x):
			if l[num] == tt:
				k.append(l[num + 1] - l[num - 1])
			else:
				k.append(l[num] - l[num - 1])
		list.append(max(k))
		k = []
	print(min(list))


a = int(input())
ans = 0
u = []
z = []
l = list(map(int, input().split()))
for i in range(a - 1):
	u.append(l[i + 1] - l[i])
	if i < a - 2:
		z.append(l[i + 2] - l[i])
u.append(min(z))
print(max(u))


n = int(input())
l1 = list(map(int, input().split()))
ans = 1000000
for i in range(1, n - 1):
	diff = l1[i + 1] - l1[i - 1]
	if diff < ans:
		ans = diff
		index = i
l1.remove(l1[index])
ans = 0
for i in range(n - 2):
	ans = max(ans, l1[i + 1] - l1[i])
print(ans)


n = int(input())
v = [int(i) for i in input().split()]
mx = 0
for i in range(1, len(v)):
	mx = max(mx, v[i] - v[i - 1])
mn = int(1000000000.0)
for i in range(1, len(v) - 1):
	mn = min(mn, max(mx, v[i + 1] - v[i - 1]))
print(mn)


N = int(input())
Arr = list(map(int, input().split()))
Lst = []
for i in range(N - 1):
	Lst = Lst + [Arr[i + 1] - Arr[i]]
(Maxx, Lst1) = (max(Lst), [])
for i in range(N - 2):
	Val = Lst[i + 1] + Lst[i]
	if Val >= Maxx:
		Lst1 = Lst1 + [Val]
	else:
		Lst1 = Lst1 + [Maxx]
print(min(Lst1))


n = int(input())
a = list(map(int, input().split()))
one = []
two = []
for i in range(0, n - 1):
	one.append(a[i + 1] - a[i])
for i in range(1, n - 1):
	two.append(a[i + 1] - a[i - 1])
ans = max(max(one), min(two))
print(ans)


n = int(input())
q = [int(x) for x in input().split()]
ans = int(1000000000.0)
for i in range(1, n - 1):
	temp = int(-1000000000.0)
	for j in range(n - 1):
		if i == j:
			continue
		elif j == i - 1:
			temp = max(temp, abs(q[j] - q[j + 2]))
		else:
			temp = max(temp, abs(q[j] - q[j + 1]))
	ans = min(ans, temp)
print(ans)


n = int(input())
a = list(map(int, input().split()))
s = list()
for i in range(n - 1):
	s.append(a[i + 1] - a[i])
diff = max(s)
minsum = 10000
for i in range(0, len(s) - 1):
	if s[i] + s[i + 1] < minsum:
		minsum = s[i] + s[i + 1]
if minsum > diff:
	print(minsum)
else:
	print(diff)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline().strip())
n = get_int()
lst = get_int_list()
m = 100000000
index = -1
for i in range(n - 2):
	if lst[i + 2] - lst[i] < m:
		m = lst[i + 2] - lst[i]
		index = i + 1
lst.pop(index)
m = 0
for i in range(n - 2):
	m = max(m, lst[i + 1] - lst[i])
print(m)


n = int(input())
l = list(map(int, input().split()))
t = []
res = []
for i in range(1, n - 1):
	t = l[:i] + l[i + 1:]
	max_diff = 0
	for j in range(len(t) - 1):
		diff = t[j + 1] - t[j]
		if diff > max_diff:
			max_diff = diff
	res.append(max_diff)
print(min(res))


input()
track = [int(i) for i in input().split()]
ans = track[-1] - track[0]
idx = 0
for (n, i) in enumerate(track[1:-1], 1):
	t = track[n + 1] - track[n - 1]
	if t < ans:
		ans = t
		idx = n
track.pop(idx)
for (n, i) in enumerate(track[:-1]):
	ans = max(ans, track[n + 1] - track[n])
print(ans)


n = int(input())
num = list(map(int, input().split()))
difflist = []
for i in range(len(num) - 1):
	difflist.append(num[i + 1] - num[i])
mlist = []
if len(difflist) < 3:
	print(sum(difflist))
else:
	for i in range(len(difflist) - 1):
		sum1 = difflist[i] + difflist[i + 1]
		mlist.append(max(sum1, max(difflist)))
	print(min(mlist))


n = int(input())
a = list(map(int, input().split()))
m = []
for i in range(1, n - 1):
	l = a[0:i] + a[i + 1:n]
	max1 = 0
	for j in range(n - 2):
		w = l[j + 1] - l[j]
		if max1 < w:
			max1 = w
	m.append(max1)
print(min(m))


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = []
	s = set()
	for i in range(1, n):
		B.append(A[i] - A[i - 1])
	min_val = 10 ** 18
	for i in range(1, len(B)):
		C = []
		for j in range(len(B)):
			if j == i - 1:
				continue
			elif j == i:
				C.append(B[j - 1] + B[j])
			else:
				C.append(B[j])
		val = max(C)
		min_val = min(min_val, val)
	print(min_val)
main()


n = int(input())
l_n = list(map(int, input().split()))
m = l_n[n - 1] - l_n[0]
for i in range(1, n - 1):
	t_m = 0
	for j in range(1, n - 1):
		if j == i:
			t_m = max(t_m, l_n[j + 1] - l_n[j - 1])
		elif j + 1 != i:
			t_m = max(t_m, l_n[j + 1] - l_n[j])
	m = min(m, t_m)
print(m)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')

def main():
	n = ri()
	a = ria()
	best = max(a) - min(a)
	for i in range(1, n - 1):
		mx = 0
		for j in range(n - 1):
			if j + 1 == i and j < n - 2:
				cur = a[j]
				nex = a[j + 2]
			elif j == i and j > 0:
				cur = a[j - 1]
				nex = a[j + 1]
			else:
				cur = a[j]
				nex = a[j + 1]
			mx = max(mx, nex - cur)
		best = min(best, mx)
	wi(best)
main()


n = int(input())
lt = [int(x) for x in input().split()]
df = []
for i in range(n - 1):
	df.append(lt[i + 1] - lt[i])
if len(df) == 1 or len(df) == 2:
	print(sum(df))
else:
	mini = df[1] + df[0]
	st = set()
	st.add(0)
	for i in range(len(df) - 1):
		if df[i + 1] + df[i] <= mini:
			mini = df[i + 1] + df[i]
			st.clear()
			st.add(i)
	k = 0
	for x in st:
		k = x
	df2 = df[0:k] + [df[k + 1] + df[k]] + df[k + 2:]
	print(max(df2))


from sys import stdin, stdout
get = stdin.readline
put = stdout.write
(n, a) = (int(get()), list(map(int, get().split())))
d = []
t = []
for i in range(n - 1):
	p = a[i + 1] - a[i]
	d.append(p)
	if t:
		t.append(d[i] + d[i - 1])
	if not t and len(d) > 1:
		t.append(d[i] + d[i - 1])
put(str(max(min(t), max(d))))


def getMax(heights):
	ans = []
	for i in range(len(heights) - 1):
		ans.append(heights[i + 1] - heights[i])
	return max(ans)

def minimumDifficulty(heights):
	ans = []
	for i in range(1, len(heights) - 1):
		popped = heights.pop(i)
		ans.append(getMax(heights))
		heights.insert(i, popped)
	return min(ans)
n = int(input())
heights = list(map(int, input().split()))
print(minimumDifficulty(heights))


def f(a):
	return max(map(lambda x: a[x + 1] - a[x], range(len(a) - 1)))
a = int(input())
b = list(map(int, input().split()))
print(min([f(b[:i + 1] + b[i + 2:]) for i in range(a - 2)]))


n = int(input())
space = []
s = input().split(' ')
mi = int(s[-1]) - int(s[0])
start = 0
for i in range(1, len(s)):
	distance = int(s[i]) - int(s[i - 1])
	space.append(distance)
for i in range(len(space) - 1):
	if space[i] + space[i + 1] < mi:
		mi = space[i] + space[i + 1]
		start = i
space.pop(start)
space.pop(start)
space.append(mi)
print(max(space))


n = int(input())
l = list(map(int, input().split()))
m = []
for i in range(1, n - 1):
	x = l[i]
	l.pop(i)
	res = [abs(j - i) for (i, j) in zip(l[:-1], l[1:])]
	m.append(max(res))
	l.insert(i, x)
print(min(m))


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l
mod = int(1000000000.0) + 7

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)

def p2(a, b):
	print(a, b)
n = iinp()
a = linp()
diff = []
if n == 3:
	print(a[2] - a[0])
else:
	for i in range(n - 1):
		diff.append(a[i + 1] - a[i])
	ms = 42874289342
	for i in range(len(diff) - 1):
		ms = min(ms, diff[i] + diff[i + 1])
	if ms <= max(diff):
		print(max(diff))
	elif ms > max(diff):
		print(ms)


def f(l):
	ans = -1005
	for i in range(1, len(l)):
		ans = max(ans, l[i] - l[i - 1])
	return ans
n = int(input())
l = [int(x) for x in input().split()]
ans = 1005
d = f(l)
for i in range(1, len(l) - 1):
	ans = min(ans, max(l[i + 1] - l[i - 1], d))
print(ans)


n = int(input())
a = list(map(int, input().split()))
sl = []
s2 = []
for i in range(n - 2):
	sl += [a[i + 2] - a[i]]
	s2 += [a[i + 1] - a[i]]
s2 += [a[-1] - a[-2]]
print(max(min(sl), max(s2)))


t = int(input())
L = list(map(int, input().split()))
if len(L) == 3:
	print(L[-1] - L[0])
else:
	M = []
	for i in range(1, len(L) - 1):
		maxi = 0
		for j in range(0, len(L) - 1):
			if i == j + 1:
				diff = L[j + 2] - L[j]
			elif i == j:
				diff = 0
			else:
				diff = L[j + 1] - L[j]
			if diff > maxi:
				maxi = diff
		M.append(maxi)
	print(min(M))


from itertools import combinations
holds = int(input())
arr = list(map(int, input().strip().split()))
z = []
new = arr[1:len(arr) - 1]
k = []
comb = list(combinations(new, holds - 3))
for i in comb:
	i = list(i)
	bro = [arr[0]] + i + [arr[len(arr) - 1]]
	for e in range(len(bro) - 1):
		z.append(bro[e + 1] - bro[e])
	k.append(max(z))
	z = []
print(min(k))


def solve(arr, n):
	res = []
	for i in range(n - 2):
		temp = arr[:]
		temp.pop(i + 1)
		max_val = 0
		for j in range(n - 2):
			if temp[j + 1] - temp[j] > max_val:
				max_val = temp[j + 1] - temp[j]
		res.append(max_val)
	return min(res)

def main():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	print(solve(arr, n))
main()


n = int(input())
ip = list(map(int, input().split()))
op = []
op2 = []
for i in range(n - 1):
	op.append(ip[i + 1] - ip[i])
for j in range(n - 2):
	op2.append(op[j + 1] + op[j])
k = op2.index(min(op2))
op.remove(op[k])
op.remove(op[k])
op.append(min(op2))
print(max(op))


input()
data = list(map(int, input().split()))
d1 = [v2 - v1 for (v1, v2) in zip(data, data[1:])]
d2 = [v2 - v1 for (v1, v2) in zip(data, data[2:])]
print(max(d1 + [min(d2)]))


n = int(input())
a = list(map(int, input().split()))
k = list(a)
m = list()
for i in range(1, n - 1):
	k.remove(k[i])
	b = 0
	for j in range(n - 2):
		if k[j + 1] - k[j] > b:
			b = k[j + 1] - k[j]
	m.append(b)
	k = list(a)
print(min(m))


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
mini = mod
for i in range(n - 2):
	result = Arr.copy()
	del result[i + 1]
	maxi = -1
	for i in range(len(result) - 1):
		if result[i + 1] - result[i] > maxi:
			maxi = result[i + 1] - result[i]
	mini = min(maxi, mini)
print(mini)


import itertools as ittls
from collections import Counter
import re
import math

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
A = list(inputarray())
res = float('inf')
for i in range(len(A) - 2):
	if A[i + 2] - A[i] < res:
		res = A[i + 2] - A[i]
print(max(max(map(lambda x: abs(x[0] - x[1]), zip(A, A[1:]))), res))


(n, l, k) = (int(input()), 0, 1000)
a = list(map(int, input().split()))
for i in range(n - 1):
	l = max(l, a[i + 1] - a[i])
	if i != n - 2:
		k = min(k, a[i + 2] - a[i])
print(max(k, l))


n = int(input())
x = input().split()
k = []
l = []
for i in range(1, n - 1):
	r = x[i]
	x.pop(i)
	for j in range(n - 2):
		k.append(int(x[j + 1]) - int(x[j]))
	l.append(max(k))
	k = []
	x.insert(i, r)
print(min(l))


n = int(input())
c = list(map(int, input().split()))
m = 10 ** 4
x = 0
for i in range(n - 1):
	x = max(c[i + 1] - c[i], x)
for i in range(n - 2):
	m = min(c[i + 2] - c[i], m)
print(max(m, x))


def maxs(l):
	max = 0
	for i in range(1, len(l)):
		if max < l[i] - l[i - 1]:
			max = l[i] - l[i - 1]
	return max
a = int(input())
l = list(map(int, input().split()))
ans = []
for i in range(1, len(l) - 1):
	ans.append(maxs(l[:i] + l[i + 1:]))
print(min(ans))


z = int(input())
x = list(map(int, input().split()))
v = x.copy()
b = 0
s = 1000
for i in range(1, z - 1):
	v.remove(v[i])
	for j in range(z - 2):
		if v[j + 1] - v[j] > b:
			b = v[j + 1] - v[j]
	if b < s:
		s = b
	v = x.copy()
	b = 0
print(s)


N = int(input())
holds = list(map(int, input().split()))
holds_diff = []
for i in range(1, N - 1):
	max_diff = []
	holds_after_remove = holds[:i] + holds[i + 1:]
	for j in range(len(holds_after_remove) - 1):
		max_diff.append(holds_after_remove[j + 1] - holds_after_remove[j])
	holds_diff.append(max(max_diff))
print(min(holds_diff))


n_val = int(input())
heights = list(map(int, input().split()))
difficulties = list()
for hold in range(1, n_val - 1):
	differences = list()
	new_heights = list()
	for ladder in list(range(0, hold)) + list(range(hold + 1, n_val)):
		new_heights.append(heights[ladder])
	for ladder in range(1, n_val - 1):
		differences.append(new_heights[ladder] - new_heights[ladder - 1])
	difficulties.append(max(differences))
print(min(difficulties))


n = int(input())
ans = []
ans1 = []
l1 = [int(x) for x in input().split()]
for x in range(len(l1) - 2):
	ans.append(l1[x + 2] - l1[x])
for x in range(len(l1) - 1):
	ans1.append(l1[x + 1] - l1[x])
print(max(max(ans1), min(ans)))


n = int(input())
a = [int(i) for i in input().split()]

def diff(a):
	best = 0
	for i in range(1, len(a)):
		best = max(best, a[i] - a[i - 1])
	return best
best = 9999
for i in range(1, n - 1):
	best = min(best, diff(a[:i] + a[i + 1:]))
print(best)


import sys
n = int(input())
an = list(map(int, sys.stdin.readline().split()))
m = an[2] - an[0]
for i in range(3, n):
	if an[i] - an[i - 2] < m:
		m = an[i] - an[i - 2]
ans = m
for i in range(1, n):
	if an[i] - an[i - 1] > ans:
		ans = an[i] - an[i - 1]
print(ans)


n = int(input())
inp = list(map(int, input().split()))
k = 100001
mingap = 100001
maxgap = 0
for i in range(n - 2):
	if inp[i + 2] - inp[i] < mingap:
		mingap = inp[i + 2] - inp[i]
		k = i
inp.remove(inp[k + 1])
for j in range(n - 2):
	if inp[j + 1] - inp[j] > maxgap:
		maxgap = inp[j + 1] - inp[j]
print(maxgap)


import sys
n = int(sys.stdin.readline())
an = [int(x) for x in sys.stdin.readline().split()]
vmax = 0
vmin = 1001
for i in range(n - 1):
	v = an[i + 1] - an[i]
	if vmax < v:
		vmax = v
	if i < n - 2:
		t = an[i + 2] - an[i]
		if t < vmin:
			vmin = t
print(max(vmax, vmin))


def max_dist(a):
	d = 0
	for i in range(1, len(a)):
		d = max(a[i] - a[i - 1], d)
	return d

def main():
	n = int(input())
	a = list(map(int, input().split()))
	d = float('inf')
	for i in range(1, n - 1):
		d = min(max_dist(a[:i] + a[i + 1:]), d)
	print(d)
main()


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
n = int(data())
heights = l()
res = []
minNew = 1001
maxCur = heights[1] - heights[0]
for p in range(1, n - 1):
	if heights[p + 1] - heights[p - 1] < minNew:
		minNew = heights[p + 1] - heights[p - 1]
	if heights[p + 1] - heights[p] > maxCur:
		maxCur = heights[p + 1] - heights[p]
ans = maxCur
if minNew > ans:
	ans = minNew
print(ans)


n = int(input())
a = list(map(int, input().split()))
m = 1000000
k = -8
for i in range(1, n - 1):
	k = i if m > a[i + 1] - a[i - 1] else k
	m = min(a[i + 1] - a[i - 1], m)
a.remove(a[k])
n = len(a)
m = 0
for i in range(1, n):
	m = max(a[i] - a[i - 1], m)
print(m)


n = int(input())
a = list(map(int, input().split()))
mn_darmion = a[2] - a[0]
for i in range(n - 2):
	mn_darmion = min(mn_darmion, a[i + 2] - a[i])
mx = a[1] - a[0]
for i in range(n - 1):
	mx = max(mx, a[i + 1] - a[i])
print(max(mx, mn_darmion))


a = int(input())
b = list(map(int, input().split()))
lis1 = [b[item] - b[item - 1] for item in range(1, a)]
lis2 = [b[item + 1] - b[item - 1] for item in range(1, a - 1)]
print(max(max(lis1), min(lis2)))


n = int(input())
l = list(map(int, input().split()))
m = []
for i in range(1, n - 1):
	p = []
	y = l[i]
	l.pop(i)
	for j in range(len(l) - 1):
		r = l[j + 1] - l[j]
		p.append(r)
	r = max(p)
	m.append(r)
	l.insert(i, y)
q = min(m)
print(q)


n = int(input())
tr = [int(i) for i in input().split()]
r = []
maxi = tr[1] - tr[0]
for i in range(1, len(tr) - 1):
	r += [tr[i + 1] - tr[i - 1]]
	if tr[i + 1] - tr[i] > maxi:
		maxi = tr[i + 1] - tr[i]
print(max(maxi, min(r)))


def difficulty(arr):
	return max([arr[i + 1] - arr[i] for i in range(len(arr) - 1)])
(n, a) = (int(input()), [int(i) for i in input().split()])
print(min([difficulty(a[:i + 1] + a[i + 2:]) for i in range(n - 2)]))


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
di4 = ((1, 0), (0, 1), (-1, 0), (0, -1))

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	prime[0] = prime[1] = False
	return (a, prime)

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def lcm(arr):
	a = arr[0]
	val = arr[0]
	for i in range(1, len(arr)):
		gcd = gcd(a, arr[i])
		a = arr[i]
		val *= arr[i]
	return val // gcd

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def IF(c, t, f):
	return t if c else f

def YES(c):
	print(IF(c, 'YES', 'NO'))

def Yes(c):
	print(IF(c, 'Yes', 'No'))

def yes(c):
	print(IF(c, 'yes', 'no'))

def JA(a, sep=' '):
	print(sep.join(map(str, a)))

def JAA(a, s='\n', t=' '):
	return s.join((t.join(map(str, b)) for b in a))

def PS(a, s=' '):
	print(str(a), end=s)

def I():
	return int(inp())

def F():
	return float(inp())

def LI():
	return list(map(int, inp().split()))

def LF():
	return list(map(float, inp().split()))

def MATI(n):
	return [LI() for i in range(n)]

def MATS(n):
	return [list(inp()) for i in range(n)]

def IV():
	return map(int, inp().split())

def FV():
	return map(float, inp().split())

def LS():
	return list(inp())

def S():
	return inp()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 0

def solve():
	n = I()
	nums = LI()
	ma = MI
	mi = MA
	for i in range(1, n):
		ma = max(ma, nums[i] - nums[i - 1])
	for i in range(2, n):
		val = max(ma, nums[i] - nums[i - 2])
		mi = min(mi, val)
	print(mi)

def main():
	flag = 1
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 0
	t = 1
	if TestCases:
		t = I()
	for _ in range(1, t + 1):
		solve()
	if flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


def difficulty(a, n, x):
	ma = -1 * int(100000000.0)
	for i in range(1, n):
		v = 0
		if i == x:
			continue
		elif i - 1 == x:
			v = a[i] - a[i - 2]
		else:
			v = a[i] - a[i - 1]
		ma = max(ma, v)
	return ma

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	mi = int(100000000.0)
	for i in range(1, n - 1):
		mi = min(difficulty(a, n, i), mi)
	print(mi)
main()


n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(1, n):
	c = max(c, a[i] - a[i - 1])
d = 1001
for i in range(1, n - 1):
	d = min(d, max(c, a[i + 1] - a[i - 1]))
print(d)


n = int(input())
a = list(map(int, input().split()))
max_d = 0
for i in range(1, n):
	max_d = max(max_d, a[i] - a[i - 1])
ans = 1000
for i in range(2, n):
	d = max(max_d, a[i] - a[i - 2])
	ans = min(ans, d)
print(ans)


def calcdiff(listx):
	maxim = -1
	for i in range(1, len(listx)):
		maxim = max(maxim, listx[i] - listx[i - 1])
	return maxim
x = int(input())
t = list(map(int, input().split(' ')))
maximx = 90000001
for i in range(1, x - 1):
	maximx = min(maximx, calcdiff(t[:i] + t[i + 1:]))
print(maximx)


def difficulty(trace, lenght):
	result = 0
	for i in range(1, lenght):
		new_result = trace[i] - trace[i - 1]
		if new_result > result:
			result = new_result
	return result
n = int(input())
trace = [int(i) for i in input().split()]
min_difficulty = trace[n - 1] - trace[0]
for i in range(1, n - 1):
	new_min = difficulty(trace[:i] + trace[i + 1:], n - 1)
	if new_min < min_difficulty:
		min_difficulty = new_min
print(min_difficulty)


def cek(arr):
	maxx = 0
	for i in range(len(arr) - 1):
		kurang = int(arr[i + 1]) - int(arr[i])
		if kurang > maxx:
			maxx = kurang
	return maxx
n = int(input())
arr = [0] * n
b = input().split(' ')
for i in range(n):
	arr[i] = int(b[i])
narr = len(arr)
ign = 0
minn = 9999
for i in range(narr - 2):
	ign += 1
	kan = []
	for j in range(narr):
		if j == ign:
			continue
		else:
			kan += [arr[j]]
	hasil = cek(kan)
	if hasil < minn:
		minn = hasil
print(minn)


n = int(input())
a = list(map(int, input().split(' ')))
minim = 0
for i in range(1, n - 1):
	if a[i + 1] - a[i - 1] < minim or minim == 0:
		minim = a[i + 1] - a[i - 1]
		k = i
a = a[:k] + a[k + 1:]
for i in range(n - 2):
	a[i] = a[i + 1] - a[i]
print(max(a[:-1]))


def cal(li):
	return max([li[i + 1] - li[i] for i in range(len(li) - 1)])
n = int(input())
a = [int(i) for i in input().split()]
print(min([cal(a[:i] + a[i + 1:]) for i in range(1, n - 1)]))


k = int(input())
a = list(map(int, input().split(' ')))
i = 1
ans = []
maxVal = 0
while i < len(a) - 1:
	sum1 = a[i + 1] - a[i - 1]
	ans.append(sum1)
	maxVal = max(maxVal, a[i + 1] - a[i])
	i = i + 1
print(max(maxVal, min(ans)))


n = int(input())
mylist = list(map(int, input().split()))
list1 = []
for i in range(1, len(mylist) - 1):
	newlist = []
	newlist.extend(mylist[0:i])
	newlist.extend(mylist[i + 1:n])
	maxi = 0
	for j in range(1, len(newlist)):
		if maxi < newlist[j] - newlist[j - 1]:
			maxi = newlist[j] - newlist[j - 1]
	list1.append(maxi)
print(min(list1))


import sys, bisect
from sys import stdin, stdout
from bisect import bisect_left, bisect_right, bisect, insort, insort_left, insort_right
from math import gcd, ceil, floor, sqrt
from collections import Counter, defaultdict, deque, OrderedDict
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 998244353
mod = 10 ** 9 + 7

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def solve():
	n = inp()
	l = li()
	k = [l[i + 1] - l[i] for i in range(n - 1)]
	ans = float('inf')
	for i in range(1, n - 1):
		z = list(k)
		cur = l[i + 1] - l[i - 1]
		z[i - 1] = cur
		ans = min(ans, max(z))
	pr(ans)
for _ in range(1):
	solve()


n = int(input())
s = [int(i) for i in input().split()]
k = s[2] - s[0]
l = 0
for i in range(n - 2):
	k = min(k, s[i + 2] - s[i])
	l = max(l, s[i + 1] - s[i])
l = max(l, s[-1] - s[-2])
print(max(l, k))


n = int(input())
seq = list(map(int, input().split()))
res = []
for i in range(1, n - 1):
	res.append((abs(seq[i] - seq[i - 1]), abs(seq[i] - seq[i + 1])))
seq.pop(res.index(min(res)) + 1)
MAX = 0
for i in range(1, n - 1):
	if abs(seq[i] - seq[i - 1]) > MAX:
		MAX = abs(seq[i] - seq[i - 1])
print(MAX)


(n,) = map(int, input().split())
a = list(map(int, input().split()))
mini = min([a[i + 1] - a[i - 1] for i in range(1, n - 1)])
maxi = max([a[i] - a[i - 1] for i in range(1, n)])
print(max(mini, maxi))


n = int(input())
l = list(map(int, input().split()))
d = 1001
e = 0
for i in range(n - 1):
	if l[i + 1] - l[i] > e:
		e = l[i + 1] - l[i]
for i in range(n - 2):
	if l[i + 2] - l[i] < d:
		d = l[i + 2] - l[i]
print(max(d, e))


n = int(input())
l1 = input()
l = list(l1.split())
for i in range(len(l)):
	l[i] = int(l[i])

def mes(x):
	s = []
	for i in range(1, len(x)):
		s.append(x[i] - x[i - 1])
	return max(s)

def ink(x):
	t = []
	for k in range(len(x)):
		t.append(x[k])
	s = []
	for i in range(len(x)):
		t.remove(t[i])
		s.append(t)
		t = []
		for k in range(len(x)):
			t.append(x[k])
	return s
temp = []
for i in range(1, len(ink(l)) - 1):
	r = ink(l)[i]
	temp.append(mes(r))
print(min(temp))


n = int(input())
m = list(map(int, input().split()))
m.sort()
(l, k) = ([], [])
for i in range(n - 2):
	l.append(m[i + 2] - m[i])
for i in range(n - 1):
	k.append(m[i + 1] - m[i])
print(max(max(k), min(l)))


n = int(input())
a = list(map(int, input().split()))
d = 1000
for i in range(1, len(a) - 1):
	b = a[:]
	b.pop(i)
	diff = []
	for j in range(len(b) - 1):
		diff.append(b[j + 1] - b[j])
	m = max(diff)
	if m < d:
		d = m
	else:
		pass
print(d)


n = int(input())
a = list(map(int, input().split()))
otvet = a[n - 1] - a[0]
maxx = 0
for i in range(n - 1):
	if a[i + 1] - a[i] > maxx:
		maxx = a[i + 1] - a[i]
minn = a[n - 1] - a[0]
for i in range(n - 2):
	if a[i + 2] - a[i] < minn:
		minn = a[i + 2] - a[i]
print(max(minn, maxx))


n = int(input())
a = list(map(int, input().split()))
diff = 0
for i in range(n):
	if i != 0:
		curr = a[i] - a[i - 1]
		if curr > diff:
			diff = curr
arr = []
for i in range(n):
	if i != 0 and i != n - 1:
		curr = a[i + 1] - a[i - 1]
		arr.append(curr)
yo = min(arr)
if yo < diff:
	print(diff)
else:
	print(yo)


(n, lst, mn, kf) = (int(input()), list(map(int, input().split())), 5001, 0)
for i in range(1, n - 1):
	if lst[i + 1] - lst[i - 1] < mn:
		kf = i
		mn = lst[i + 1] - lst[i - 1]
del lst[kf]
mn = 0
for i in range(n - 2):
	if lst[i + 1] - lst[i] > mn:
		mn = lst[i + 1] - lst[i]
print(mn)


import sys
numberofrocks = int(sys.stdin.readline())
listofrocks = list(map(int, sys.stdin.readline().rstrip('\n').split()))
listofgaps = [listofrocks[1] - listofrocks[0]]
listofgapsafterremoving = []
for index in range(1, numberofrocks - 1):
	listofgaps.append(listofrocks[index + 1] - listofrocks[index])
	listofgapsafterremoving.append(listofrocks[index + 1] - listofrocks[index - 1])
solution = max(max(listofgaps), min(listofgapsafterremoving))
print(solution)


[n] = list(map(int, input().split()))
a = list(map(int, input().split()))
if n <= 3:
	print(a[-1] - a[0])
else:
	d = []
	md = []
	for i in range(1, n):
		d.append(a[i] - a[i - 1])
	dmax = max(d)
	for i in range(2, n):
		md.append(max(a[i] - a[i - 2], dmax))
	print(min(md))


n = input()
h = list(input().strip().split(' '))
h = list(map(int, h))
listas = []
aux = []
for x in range(1, int(n) - 1):
	aux = set(h)
	aux1 = []
	aux1.append(h[x])
	aux -= set(aux1)
	listas.append(sorted(aux))
result = []
for combinacion in listas:
	r = []
	for y in range(0, len(combinacion) - 1):
		d = int(combinacion[int(y) + 1]) - int(combinacion[int(y)])
		r.append(d)
	result.append(max(r))
print(min(result))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LI()
	r = inf
	for i in range(1, n - 1):
		t = a[i + 1] - a[i - 1]
		if r > t:
			r = t
	for i in range(n - 1):
		t = a[i + 1] - a[i]
		if r < t:
			r = t
	return r
print(main())


n = int(input())
l = input().split()
ans = 10 ** 50
for i in range(n):
	l[i] = int(l[i])
for i in range(1, n - 1):
	curr = 0
	m = l[:i] + l[i + 1:]
	for i in range(n - 2):
		curr = max(curr, m[i + 1] - m[i])
	if curr < ans:
		ans = curr
print(ans)


n = int(input())
x = input()
x = x.split(' ')
a = []
c = []
b = []
for i in range(0, len(x)):
	x[i] = int(x[i])
for i in range(1, len(x) - 1):
	a.clear()
	a.extend(x)
	a.remove(a[i])
	for j in range(0, len(a) - 1):
		b.append(a[j + 1] - a[j])
	c.append(max(b))
	b = []
print(min(c))