All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position x_{i} — a coordinate on the Ox axis. No two cities are located at a single point.

Lineland residents love to send letters to each other. A person may send a letter only if the recipient lives in another city (because if they live in the same city, then it is easier to drop in).

Strange but true, the cost of sending the letter is exactly equal to the distance between the sender's city and the recipient's city.

For each city calculate two values ​​min_{i} and max_{i}, where min_{i} is the minimum cost of sending a letter from the i-th city to some other city, and max_{i} is the the maximum cost of sending a letter from the i-th city to some other city


-----Input-----

The first line of the input contains integer n (2 ≤ n ≤ 10^5) — the number of cities in Lineland. The second line contains the sequence of n distinct integers x_1, x_2, ..., x_{n} ( - 10^9 ≤ x_{i} ≤ 10^9), where x_{i} is the x-coordinate of the i-th city. All the x_{i}'s are distinct and follow in ascending order.


-----Output-----

Print n lines, the i-th line must contain two integers min_{i}, max_{i}, separated by a space, where min_{i} is the minimum cost of sending a letter from the i-th city, and max_{i} is the maximum cost of sending a letter from the i-th city.


-----Examples-----
Input
4
-5 -2 2 7

Output
3 12
3 9
4 7
5 12

Input
2
-1 1

Output
2 2
2 2

Difficulty: EASY

Solutions:
a = int(input())
b = list(map(int, input().split()))
i = 0
ma = 0
mi = 0
while i < a:
	if i == 0 or i == a - 1:
		ma = abs(b[0] - b[a - 1])
		if i == 0:
			mi = abs(b[0] - b[1])
		else:
			mi = abs(b[a - 1] - b[a - 2])
	else:
		max1 = abs(b[i] - b[a - 1])
		max2 = abs(b[i] - b[0])
		min1 = abs(b[i] - b[i - 1])
		min2 = abs(b[i] - b[i + 1])
		if min1 > min2:
			mi = min2
		else:
			mi = min1
		if max1 > max2:
			ma = max1
		else:
			ma = max2
	print(mi, ma)
	i += 1


n = int(input())
a = [int(x) for x in input().split()]
print('{0} {1}'.format(a[1] - a[0], a[n - 1] - a[0]))
for i in range(1, n - 1):
	print('{0} {1}'.format(min(a[i] - a[i - 1], a[i + 1] - a[i]), max(a[i] - a[0], a[n - 1] - a[i])))
print('{0} {1}'.format(a[n - 1] - a[n - 2], a[n - 1] - a[0]))


import math

def calculateDistanceTwoPoints(p1, p2):
	return int(math.sqrt((p2 - p1) ** 2))
n_cities = int(input())
distances = list(map(int, input().split(' ')))
max_dist = 0
min_dist = 0
for i in range(n_cities):
	if i == 0:
		min_dist = calculateDistanceTwoPoints(distances[0], distances[1])
		max_dist = calculateDistanceTwoPoints(distances[0], distances[n_cities - 1])
	elif i == n_cities - 1:
		min_dist = calculateDistanceTwoPoints(distances[i], distances[i - 1])
		max_dist = calculateDistanceTwoPoints(distances[i], distances[0])
	else:
		right_neib_dist = calculateDistanceTwoPoints(distances[i], distances[i + 1])
		left_neib_dist = calculateDistanceTwoPoints(distances[i], distances[i - 1])
		min_dist = min(right_neib_dist, left_neib_dist)
		dist_to_end = calculateDistanceTwoPoints(distances[i], distances[n_cities - 1])
		dist_to_begin = calculateDistanceTwoPoints(distances[i], distances[0])
		max_dist = max(dist_to_end, dist_to_begin)
	print(min_dist, max_dist)


num = int(input())
coordinates = input().split(' ')
if len(coordinates) == num:
	for i in range(len(coordinates)):
		min = 0
		max = 0
		if i == 0:
			min = int(coordinates[1]) - int(coordinates[0])
			max = int(coordinates[-1]) - int(coordinates[0])
		elif int(coordinates[i]) == int(coordinates[-1]):
			min = int(coordinates[-1]) - int(coordinates[-2])
			max = int(coordinates[-1]) - int(coordinates[0])
		else:
			min = int(coordinates[i]) - int(coordinates[i - 1])
			max = int(coordinates[-1]) - int(coordinates[i])
			if int(coordinates[i + 1]) - int(coordinates[i]) < min:
				min = int(coordinates[i + 1]) - int(coordinates[i])
			if int(coordinates[i]) - int(coordinates[0]) > max:
				max = int(coordinates[i]) - int(coordinates[0])
		print(str(min) + ' ' + str(max))


a = int(input())
t = list(map(int, input().split()))
t.sort()
p = []
for k in range(a - 1):
	if k == 0:
		p.append([t[1] - t[0], t[-1] - t[0]])
	else:
		p.append([min(t[k + 1] - t[k], t[k] - t[k - 1]), max(t[a - 1] - t[k], t[k] - t[0])])
p.append([t[-1] - t[-2], t[-1] - t[0]])
for s in p:
	print(*s)


n = int(input())
x = list(map(int, input().split()))
mincost = []
maxcost = []
mincost.append(x[1] - x[0])
maxcost.append(x[n - 1] - x[0])
for i in range(1, n - 1):
	mincost.append(min(x[i] - x[i - 1], x[i + 1] - x[i]))
	maxcost.append(max(x[i] - x[0], x[n - 1] - x[i]))
mincost.append(x[n - 1] - x[n - 2])
maxcost.append(x[n - 1] - x[0])
for i in range(0, n):
	print(mincost[i], maxcost[i])


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


import sys
idx = 0
cities = []
for line in sys.stdin:
	if idx == 1:
		temp = line.split()
		for i in temp:
			cities.append(int(i))
		break
	else:
		idx += 1
cities.sort()
return_list = []
for idx in range(len(cities)):
	if idx == len(cities) - 1:
		min = cities[idx] - cities[idx - 1]
		max = cities[idx] - cities[0]
		return_list.append([min, max])
		continue
	if abs(cities[idx] - cities[idx + 1]) > abs(cities[idx] - cities[idx - 1]):
		min = abs(cities[idx] - cities[idx - 1])
	else:
		min = abs(cities[idx] - cities[idx + 1])
	if abs(cities[idx] - cities[0]) > abs(cities[idx] - cities[-1]):
		max = abs(cities[idx] - cities[0])
	else:
		max = abs(cities[idx] - cities[-1])
	return_list.append([min, max])
for i in return_list:
	print('{min} {max}'.format(min=i[0], max=i[1]))


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

def calcular_distancia(ponto_a, ponto_b):
	return abs(ponto_a - ponto_b)
for i in range(len(pontos)):
	menor = None
	maior = None
	if i == 0:
		maior = calcular_distancia(pontos[i], pontos[n - 1])
		menor = calcular_distancia(pontos[i], pontos[1])
	elif i == n - 1:
		maior = calcular_distancia(pontos[i], pontos[0])
		menor = calcular_distancia(pontos[i], pontos[i - 1])
	else:
		maior = max([calcular_distancia(pontos[i], pontos[0]), calcular_distancia(pontos[i], pontos[n - 1])])
		menor = min([calcular_distancia(pontos[i], pontos[i - 1]), calcular_distancia(pontos[i], pontos[i + 1])])
	print(menor, maior)


import math
length = int(input())
data = input().split(' ')
data = [int(item) for item in data]
for i in range(length):
	(big, small) = (0, 99999999999999)
	if i == 0:
		small = abs(data[i + 1] - data[i])
		big = abs(data[length - 1] - data[i])
	elif i == length - 1:
		small = abs(data[length - 2] - data[i])
		big = abs(data[0] - data[i])
	else:
		small = min(abs(data[i + 1] - data[i]), abs(data[i - 1] - data[i]))
		big = max(abs(data[0] - data[i]), abs(data[length - 1] - data[i]))
	print(str(small) + ' ' + str(big))


n = int(input())
mas = [i for i in map(int, input().split())]
for i in range(n):
	if i == 0:
		print(mas[i + 1] - mas[i], end=' ')
	elif i == n - 1:
		print(mas[i] - mas[i - 1], end=' ')
	elif mas[i + 1] - mas[i] < mas[i] - mas[i - 1]:
		print(mas[i + 1] - mas[i], end=' ')
	else:
		print(mas[i] - mas[i - 1], end=' ')
	if mas[i] - mas[0] > mas[n - 1] - mas[i]:
		print(mas[i] - mas[0])
	else:
		print(mas[n - 1] - mas[i])


input()
l = list(map(int, input().split()))
(a, f) = (l[0], l[-1])
print(l[1] - a, f - a)
for (b, c, d) in zip(l, l[1:], l[2:]):
	print(min(c - b, d - c), max(c - a, f - c))
print(f - l[-2], f - a)


def mail(arr):
	i = 0
	while i < len(arr):
		if i == 0:
			smol = abs(arr[i + 1] - arr[i])
			big = abs(arr[i] - arr[-1])
		elif i == len(arr) - 1:
			smol = abs(arr[i] - arr[i - 1])
			big = abs(arr[i] - arr[0])
		else:
			smol1 = abs(arr[i] - arr[i - 1])
			smol2 = abs(arr[i] - arr[i + 1])
			smol = min(smol1, smol2)
			big1 = abs(arr[i] - arr[0])
			big2 = abs(arr[i] - arr[-1])
			big = max(big1, big2)
		print(smol, big)
		i += 1
n = int(input())
arr = list(map(int, input().rstrip().split()))
mail(arr)


n = int(input())
s = input()
s = s.split(' ')
v = [int(s[i]) for i in range(n)]
v.sort()
for i in range(n):
	if i > 0 and i < n - 1:
		print(min(v[i + 1] - v[i], v[i] - v[i - 1]), max(v[i] - v[0], v[-1] - v[i]))
	elif i == 0:
		print(v[i + 1] - v[i], v[-1] - v[i])
	else:
		print(v[i] - v[i - 1], v[i] - v[0])


n = int(input())
coords = [int(x) for x in input().split()]
last = n - 1
print(coords[1] - coords[0], coords[last] - coords[0])
i = 1
while i < last:
	print(min(abs(coords[i + 1] - coords[i]), abs(coords[i] - coords[i - 1])), max(abs(coords[i] - coords[0]), abs(coords[last] - coords[i])))
	i += 1
print(coords[last] - coords[last - 1], coords[last] - coords[0])


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


n = int(input())
numeros = list(map(int, input().split()))
print(abs(numeros[0] - numeros[1]), abs(numeros[0] - numeros[-1]))
for i in range(1, len(numeros) - 1):
	minimo = min(abs(numeros[i] - numeros[i - 1]), abs(numeros[i] - numeros[i + 1]))
	maximo = max(abs(numeros[i] - numeros[0]), abs(numeros[i] - numeros[-1]))
	print(minimo, maximo)
print(abs(numeros[-1] - numeros[-2]), abs(numeros[-1] - numeros[0]))


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if i == 0:
		print(abs(a[i + 1] - a[i]), abs(a[-1] - a[i]))
	elif i == n - 1:
		print(abs(a[n - 1] - a[-2]), abs(a[n - 1] - a[0]))
	else:
		m = min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i]))
		ma = max(abs(a[-1] - a[i]), abs(a[i] - a[0]))
		print(m, ma)


n = int(input())
arr = input().split(' ')
for i in range(n):
	if i == 0:
		lmax = abs(int(arr[n - 1]) - int(arr[0]))
		lmin = abs(int(arr[1]) - int(arr[0]))
	elif i == n - 1:
		lmax = abs(int(arr[0]) - int(arr[n - 1]))
		lmin = abs(int(arr[n - 2]) - int(arr[n - 1]))
	else:
		lmin = min(abs(int(arr[i - 1]) - int(arr[i])), abs(int(arr[i + 1]) - int(arr[i])))
		lmax = max(abs(int(arr[0]) - int(arr[i])), abs(int(arr[n - 1]) - int(arr[i])))
	print('%d %d' % (lmin, lmax))


n = int(input())
cities = []
[cities.append(int(i)) for i in input().split()]
for i in range(len(cities)):
	if i == 0:
		min = abs(cities[i] - cities[i + 1])
		max = abs(cities[i] - cities[len(cities) - 1])
	elif i == len(cities) - 1:
		min = abs(cities[i] - cities[i - 1])
		max = abs(cities[i] - cities[0])
	else:
		min = abs(cities[i] - cities[i - 1]) if abs(cities[i] - cities[i - 1]) < abs(cities[i] - cities[i + 1]) else abs(cities[i] - cities[i + 1])
		max = abs(cities[i] - cities[0]) if abs(cities[i] - cities[0]) > abs(cities[i] - cities[len(cities) - 1]) else abs(cities[i] - cities[len(cities) - 1])
	print(str(min) + ' ' + str(max))


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	print(min(l[i] - l[i - 1] if not i == 0 else 2000000001, l[i + 1] - l[i] if not i == n - 1 else 2000000001), max(l[i] - l[0] if not i == 0 else 0, l[n - 1] - l[i] if not i == n - 1 else 0))


n = int(input())
locs = [int(x) for x in input().split()]
for i in range(n):
	if i == 0:
		minres = locs[i + 1] - locs[i]
		maxres = locs[-1] - locs[i]
	elif i == n - 1:
		minres = locs[i] - locs[i - 1]
		maxres = locs[i] - locs[0]
	else:
		minres = min(locs[i] - locs[i - 1], locs[i + 1] - locs[i])
		maxres = max(locs[i] - locs[0], locs[-1] - locs[i])
	print(minres, maxres)


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


input()
li = list(map(int, input().split()))
i = 0
while i < len(li):
	if i == 0:
		Max = li[-1] - li[0]
		Min = li[1] - li[0]
	elif i == len(li) - 1:
		Max = li[-1] - li[0]
		Min = li[-1] - li[-2]
	else:
		Min = min([li[i + 1] - li[i], li[i] - li[i - 1]])
		Max = max([li[-1] - li[i], li[i] - li[0]])
	i += 1
	print(Min, Max)


x = int(input())
n = list(map(int, input().split()))[:x]
for j in range(x):
	if j == 0:
		print(abs(n[1] - n[0]), abs(n[x - 1] - n[0]), sep=' ')
	elif j == x - 1:
		print(abs(n[x - 1] - n[x - 2]), abs(n[x - 1] - n[0]), sep=' ')
	else:
		a = abs(n[j] - n[j - 1])
		b = abs(n[j + 1] - n[j])
		c = abs(n[j] - n[0])
		d = abs(n[j] - n[x - 1])
		print(min(a, b), max(c, d), sep=' ')


is_debug = False
n = int(input())
c = list(map(int, input().split()))
l = len(c)
for i in range(l):
	if i == 0:
		min_a = c[1]
		min_b = c[1]
		max_a = c[l - 1]
		max_b = c[l - 1]
	elif i == l - 1:
		min_a = c[l - 2]
		min_b = c[l - 2]
		max_a = c[0]
		max_b = c[0]
	else:
		min_a = c[0]
		min_b = c[i + 1]
		max_a = c[i - 1]
		max_b = c[l - 1]
	print(f'min_a={min_a}, max_a={max_a}', end='|') if is_debug else ''
	print(f'min_b={min_b}, max={max_b}', end='|') if is_debug else ''
	mn = min(abs(c[i] - max_a), abs(c[i] - min_b))
	mx = max(abs(c[i] - min_a), abs(c[i] - max_b))
	print(f'{mn} {mx}')


n = int(input())
nums = list(map(int, input().split()))
max = min = 0
for i in range(n):
	if abs(nums[i] - nums[0]) > abs(nums[len(nums) - 1] - nums[i]):
		max = abs(nums[i] - nums[0])
	else:
		max = abs(nums[len(nums) - 1] - nums[i])
	if i == 0:
		min = abs(nums[1] - nums[0])
	elif i == len(nums) - 1:
		min = abs(nums[i] - nums[i - 1])
	elif abs(nums[i] - nums[i - 1]) > abs(nums[i + 1] - nums[i]):
		min = abs(nums[i + 1] - nums[i])
	else:
		min = abs(nums[i] - nums[i - 1])
	print(min, max)


n = int(input())
x = [int(i) for i in input().split()]
for i in range(n):
	maximum = max(abs(x[i] - x[0]), abs(x[i] - x[-1]))
	if i == 0:
		minimum = abs(x[i] - x[1])
	elif i == n - 1:
		minimum = abs(x[i] - x[n - 2])
	else:
		minimum = min(abs(x[i] - x[i - 1]), abs(x[i] - x[i + 1]))
	print(minimum, maximum)


import unittest
import sys

class Mail:

	def __init__(self, args):
		(self.imax, self.nums) = args

	def calculate(self):
		result = []
		for i in range(self.imax):
			dmin = min(abs(self.nums[i] - self.nums[(i - 1) % self.imax]), abs(self.nums[i] - self.nums[(i + 1) % self.imax]))
			dmax = max(abs(self.nums[i] - self.nums[0]), abs(self.nums[i] - self.nums[-1]))
			result.append((dmin, dmax))
		return str('\n'.join((' '.join(map(str, n)) for n in result)))

def get_inputs(test_inputs=None):
	it = iter(test_inputs.split('\n')) if test_inputs else None

	def uinput():
		if it:
			return next(it)
		else:
			return sys.stdin.readline().rstrip()
	imax = int(uinput())
	nums = list(map(int, uinput().split()))
	return [imax, nums]

def calculate(test_inputs=None):
	return Mail(get_inputs(test_inputs)).calculate()

class unitTests(unittest.TestCase):

	def test_Mail_class__basic_functions(self):
		d = Mail([4, [-5, -2, 2, 7]])
		self.assertEqual(d.imax, 4)

	def test_sample_tests(self):
		test = '4\n-5 -2 2 7'
		self.assertEqual(calculate(test), '3 12\n3 9\n4 7\n5 12')
		self.assertEqual(get_inputs(test)[0], 4)
		self.assertEqual(list(get_inputs(test)[1]), [-5, -2, 2, 7])
		test = '2\n-1 1'
		self.assertEqual(calculate(test), '2 2\n2 2')
		test = '1\n12'

	def test_time_limit_test(self):
		import random
		imax = 1000
		num = str(imax)
		test = num + '\n'
		nums = [random.randint(1, 10000) for i in range(imax)]
		test += ' '.join(map(str, nums)) + '\n'
		import timeit
		start = timeit.default_timer()
		args = get_inputs(test)
		init = timeit.default_timer()
		d = Mail(args)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTime Test: ' + '{0:.3f}s (inp {1:.3f}s init {2:.3f}s calc {3:.3f}s)'.format(stop - start, init - start, calc - init, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(calculate())


n = int(input())
data = list(map(int, input().split()))
for i in range(n):
	mini = 10000000000
	if i != 0:
		mini = min(data[i] - data[i - 1], mini)
	if i != n - 1:
		mini = min(data[i + 1] - data[i], mini)
	maxi = max(data[n - 1] - data[i], data[i] - data[0])
	print(mini, maxi)


n: int = int(input())
nums = list(map(lambda x: int(x), input().split(' ')))
nums.sort()
for (i, num) in enumerate(nums):
	if i == 0:
		print(abs(num - nums[i + 1]), abs(num - nums[n - 1]))
	elif i + 1 < n:
		print(min(abs(num - nums[i + 1]), abs(num - nums[i - 1])), max(abs(num - nums[n - 1]), abs(num - nums[0])))
	else:
		print(abs(num - nums[n - 2]), abs(num - nums[0]))


__author__ = 'user'
n = int(input())
arr = [int(x) for x in input().split()]
i = 0
a = abs(arr[i] - arr[i + 1])
b = abs(arr[i] - arr[n - 1])
print(a, b)
for i in range(1, n - 1):
	a = min(abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1]))
	b = max(abs(arr[i] - arr[0]), abs(arr[i] - arr[n - 1]))
	print(a, b)
i = n - 1
a = abs(arr[i] - arr[i - 1])
b = abs(arr[i] - arr[0])
print(a, b)


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


n = int(input())
a = [int(s) for s in input().split()]
for i in range(n):
	if i == 0:
		print(a[1] - a[0], a[-1] - a[0])
	elif i == n - 1:
		print(a[i] - a[i - 1], a[i] - a[0])
	else:
		print(min(a[i] - a[i - 1], a[i + 1] - a[i]), max(a[i] - a[0], a[-1] - a[i]))


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


n = int(input())
a = list(map(int, input().split()))
m = -1 * a[0]
for i in range(n):
	a[i] += m
for i in range(n):
	(mi, ma) = (0, 0)
	if i == 0:
		ma = a[n - 1]
		mi = a[i + 1]
	elif i == n - 1:
		ma = a[n - 1]
		mi = a[i] - a[i - 1]
	else:
		ma = max(a[i], a[n - 1] - a[i])
		mi = min(a[i] - a[i - 1], a[i + 1] - a[i])
	print(mi, ma)


n = int(input())
p = []
v = []
l = sorted(list(map(int, input().split())))
for i in range(n):
	if abs(l[i] - l[-1]) > abs(l[i] - l[0]):
		v.append(abs(l[i] - l[-1]))
	else:
		v.append(abs(l[i] - l[0]))
for i in range(n - 1):
	if abs(l[i] - l[i - 1]) < abs(l[i] - l[i + 1]):
		p.append(abs(l[i] - l[i - 1]))
	else:
		p.append(abs(l[i] - l[i + 1]))
p.append(l[-1] - l[-2])
for (i, j) in zip(v, p):
	print(j, i)


def main():
	n = int(input())
	ls = list(map(int, input().split()))
	minimum = ls[1] - ls[0]
	maximum = ls[len(ls) - 1] - ls[0]
	print(minimum, maximum, sep=' ')
	for i in range(1, len(ls) - 1):
		minimum = min(ls[i + 1] - ls[i], ls[i] - ls[i - 1])
		maximum = max(ls[i] - ls[0], ls[len(ls) - 1] - ls[i])
		print(minimum, maximum, sep=' ')
	minimum = ls[len(ls) - 1] - ls[len(ls) - 2]
	maximum = ls[len(ls) - 1] - ls[0]
	print(minimum, maximum, sep=' ')
main()


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


n = int(input())
s = [int(i) for i in input().split()]
ans1 = [0] * n
ans2 = [2000000003] * n
for i in range(n):
	ans1[i] = max(abs(s[i] - s[0]), abs(s[i] - s[-1]))
	if i != 0 and i != n - 1:
		ans2[i] = min(abs(s[i] - s[i + 1]), abs(s[i] - s[i - 1]))
	elif i == 0:
		ans2[i] = abs(s[0] - s[1])
	else:
		ans2[i] = abs(s[n - 2] - s[n - 1])
for i in range(n):
	print(ans2[i], ans1[i])


b = int(input())
a = list(map(int, input().split()))
for j in range(b):
	if j == 0:
		mi = a[1] - a[0]
		ma = a[b - 1] - a[0]
	elif j == b - 1:
		mi = a[b - 1] - a[b - 2]
		ma = a[b - 1] - a[0]
	else:
		mi = min(a[j] - a[j - 1], abs(a[j] - a[j + 1]))
		ma = max(abs(a[j] - a[0]), abs(a[j] - a[b - 1]))
	print(mi, end=' ')
	print(ma)


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


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


n = int(input())
l = list(map(int, input().split()))
s = 1
mi = {}
mx = {}
for i in range(n):
	if i == 0:
		mi[s] = abs(l[i + 1] - l[i])
	elif i == n - 1:
		mi[s] = abs(l[i - 1] - l[i])
	else:
		mi[s] = min(abs(l[i + 1] - l[i]), abs(l[i - 1] - l[i]))
	if i == 0:
		mx[s] = abs(l[n - 1] - l[i])
	elif i == n - 1:
		mx[s] = abs(l[0] - l[i])
	else:
		mx[s] = max(abs(l[0] - l[i]), abs(l[n - 1] - l[i]))
	s += 1
for i in range(1, n + 1):
	print(mi[i], mx[i])


n = int(input())
l = list(map(int, input().split()))
for f in range(n):
	if f == 0:
		print(l[1] - l[0], l[-1] - l[0])
	elif f == n - 1:
		print(l[f] - l[f - 1], l[f] - l[0])
	else:
		print(min(l[f] - l[f - 1], l[f + 1] - l[f]), max(l[-1] - l[f], l[f] - l[0]))


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


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(a[1] - a[0], a[n - 1] - a[0])
	elif i == n - 1:
		print(a[n - 1] - a[n - 2], a[n - 1] - a[0])
	else:
		x1 = a[i + 1] - a[i]
		x2 = a[i] - a[i - 1]
		y1 = a[n - 1] - a[i]
		y2 = a[i] - a[0]
		print(min(x1, x2), max(y1, y2))


count = int(input())
line = [int(x) for x in input().split()]
line = [line[-1]] + line + [line[0]]
for x in range(1, count + 1):
	print(min(abs(line[x] - line[x + 1]), abs(line[x] - line[x - 1])), max(abs(line[x] - line[0]), abs(line[x] - line[-1])))


from math import *
(_, v) = (input(), [int(i) for i in input().split()])
for i in range(len(v)):
	if i == 0:
		x = abs(v[1] - v[0])
	elif i == len(v) - 1:
		x = abs(v[i] - v[-2])
	else:
		x = min(abs(v[i - 1] - v[i]), abs(v[i] - v[i + 1]))
	print(x, max(abs(v[0] - v[i]), abs(v[-1] - v[i])))


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


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


import itertools

def solve(xs):
	mmm = 10000000000
	neighbour_dist = [mmm] + [y - x for (x, y) in zip(xs, xs[1:])] + [mmm]
	min_dists = [min(a, b) for (a, b) in zip(neighbour_dist, neighbour_dist[1:])]
	max_dists = [max(xs[-1] - x, x - xs[0]) for x in xs]
	return zip(min_dists, max_dists)

def main():
	n = int(input())
	xs = [int(i) for i in input().strip().split()]
	assert len(xs) == n
	result = solve(xs)
	for out in result:
		print(' '.join((str(c) for c in out)))
main()


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	if i == 0:
		min_i = abs(a[i] - a[i + 1])
	elif i == n - 1:
		min_i = abs(a[i] - a[i - 1])
	else:
		min_i = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
	max_i = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(min_i, max_i)


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


def diferenta(x, y):
	if x >= 0 and y >= 0:
		return y - x
	elif x <= 0 and y <= 0:
		return abs(x) - abs(y)
	else:
		return abs(x) + y
n = int(input())
l = list(map(int, input().split()))
print(diferenta(l[0], l[1]), diferenta(l[0], l[len(l) - 1]))
for i in range(1, len(l) - 1):
	print(min(diferenta(l[i - 1], l[i]), diferenta(l[i], l[i + 1])), max(diferenta(l[i], l[len(l) - 1]), diferenta(l[0], l[i])))
print(diferenta(l[len(l) - 2], l[len(l) - 1]), diferenta(l[0], l[len(l) - 1]))


a = int(input())
location = {}
p = list((int(i) for i in input().split()))
for i in range(a):
	location[i + 1] = p[i]
mydist = {}

def dist(a, b, location):
	return abs(location[a] - location[b])

def minmax(a, location):
	f = []
	for i in location:
		if i != a:
			f.append(dist(i, a, location))
	return (min(f), max(f))
print('{} {}'.format(dist(1, 2, location), dist(1, a, location)))
for i in range(2, a):
	print('{} {}'.format(min(dist(i, i - 1, location), dist(i, i + 1, location)), max(dist(i, 1, location), dist(i, a, location))))
print('{} {}'.format(dist(a, a - 1, location), dist(1, a, location)))


p = int(input())
array1 = list(map(int, input().split()))
print(abs(array1[0] - array1[1]), abs(array1[0] - array1[-1]))
for i in range(1, p - 1):
	maxi = max(abs(array1[i] - array1[i - 1]), abs(array1[i] - array1[i + 1]), abs(array1[i] - array1[-1]), abs(array1[i] - array1[0]))
	mini = min(abs(array1[i] - array1[i - 1]), abs(array1[i] - array1[i + 1]), abs(array1[i] - array1[-1]), abs(array1[i] - array1[0]))
	print(mini, maxi)
print(abs(array1[-1] - array1[-2]), abs(array1[-1] - array1[0]))


num = int(input())
coo = input().split()
minn = int(coo[1]) - int(coo[0])
maxx = int(coo[num - 1]) - int(coo[0])
print(minn, maxx)
for i in range(1, len(coo) - 1):
	minn = min(int(coo[i + 1]) - int(coo[i]), int(coo[i]) - int(coo[i - 1]))
	maxx = max(int(coo[num - 1]) - int(coo[i]), int(coo[i]) - int(coo[0]))
	print(minn, maxx)
minn = int(coo[num - 1]) - int(coo[num - 2])
maxx = int(coo[num - 1]) - int(coo[0])
print(minn, maxx)


n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	if i > 0:
		if i < n - 1:
			mn = min(arr[i] - arr[i - 1], arr[i + 1] - arr[i])
			mx = max(arr[i] - arr[0], arr[-1] - arr[i])
		else:
			mn = arr[i] - arr[i - 1]
			mx = arr[i] - arr[0]
	else:
		mn = arr[i + 1] - arr[i]
		mx = arr[-1] - arr[i]
	print(mn, mx)


_ = input()
inp = list(map(int, input().rstrip().split()))
res = []

def find_min(index, inp):
	if index == 0:
		return abs(inp[index] - inp[index + 1])
	elif index == len(inp) - 1:
		return abs(inp[index] - inp[index - 1])
	else:
		return min(abs(inp[index] - inp[index - 1]), abs(inp[index] - inp[index + 1]))

def find_max(index, inp):
	if index == 0:
		return abs(inp[index] - inp[len(inp) - 1])
	elif index == len(inp) - 1:
		return abs(inp[index] - inp[0])
	else:
		return max(abs(inp[index] - inp[len(inp) - 1]), abs(inp[index] - inp[0]))
for i in range(0, len(inp)):
	s = ''
	s += str(find_min(i, inp))
	s += ' '
	s += str(find_max(i, inp))
	res.append(s)
for i in res:
	print(i)


n = int(input())
A = list(map(int, input().split()))
for i in range(len(A)):
	if i == 0:
		print(A[i + 1] - A[i], end=' ')
		print(A[-1] - A[i])
	elif i == len(A) - 1:
		print(A[i] - A[i - 1], end=' ')
		print(A[i] - A[0])
	else:
		print(min(A[i] - A[i - 1], A[i + 1] - A[i]), end=' ')
		print(max(A[i] - A[0], A[-1] - A[i]))


n = int(input())
a = list(sorted(((v, i) for (i, v) in enumerate(map(int, input().split())))))
r = {}
r[0] = (a[1][0] - a[0][0], a[-1][0] - a[0][0])
r[n - 1] = (a[-1][0] - a[-2][0], a[-1][0] - a[0][0])
for i in range(1, n - 1):
	r[a[i][1]] = (min(a[i][0] - a[i - 1][0], a[i + 1][0] - a[i][0]), max(a[i][0] - a[0][0], a[-1][0] - a[i][0]))
for i in range(n):
	print(*r[i])


from sys import stdin
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
sm = a[0]
xl = a[n - 1]
dif = xl - sm
print(a[1] - sm, dif)
for i in range(1, n - 1):
	mn = min(a[i] - a[i - 1], a[i + 1] - a[i])
	mx = max(a[i] - sm, xl - a[i])
	print(mn, mx)
print(a[n - 1] - a[n - 2], dif)


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


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


n = int(input())
x = [int(c) for c in input().split()]
print(x[1] - x[0], x[len(x) - 1] - x[0])
for i in range(1, n - 1):
	l = x[i] - x[i - 1]
	r = x[i + 1] - x[i]
	print(l if l < r else r, end=' ')
	l = x[i] - x[0]
	r = x[len(x) - 1] - x[i]
	print(l if l > r else r)
print(x[len(x) - 1] - x[len(x) - 2], x[len(x) - 1] - x[0])


input()
l = list(map(int, input().split(' ')))
l.sort()
for i in range(len(l)):
	if i == 0:
		print(abs(l[1] - l[0]), abs(l[len(l) - 1] - l[0]))
	elif i == len(l) - 1:
		print(abs(l[len(l) - 1] - l[len(l) - 2]), abs(l[len(l) - 1] - l[0]))
	else:
		mn = min(abs(l[i - 1] - l[i]), abs(l[i + 1] - l[i]))
		mx = max(abs(l[i] - l[0]), abs(l[len(l) - 1] - l[i]))
		print(mn, mx)


count = int(input())
towns = input()
towns = [int(i) for i in towns.strip().split()]
first = 0
last = len(towns)
prv = None
nxt = None
for t in range(last):
	if t == first:
		nxt = towns[t + 1]
		mn = abs(towns[t] - nxt)
		mx = abs(towns[t] - towns[-1])
		print('{0} {1}'.format(mn, mx))
	elif t == last - 1:
		prv = towns[-2]
		mn = abs(towns[t] - prv)
		mx = abs(towns[t] - towns[0])
		print('{0} {1}'.format(mn, mx))
	else:
		prv = towns[t - 1]
		nxt = towns[t + 1]
		mn = abs(prv - towns[t]) if abs(prv - towns[t]) < abs(towns[t] - nxt) else abs(towns[t] - nxt)
		mx = abs(towns[0] - towns[t]) if abs(towns[0] - towns[t]) > abs(towns[t] - towns[-1]) else abs(towns[t] - towns[-1])
		print('{0} {1}'.format(mn, mx))


noOfCities = int(input())
coOrdinatesOfCities = [int(x) for x in input().split(' ')]
for (index, currentCityCoOrdinate) in enumerate(coOrdinatesOfCities):
	if index == 0:
		minDistance = abs(coOrdinatesOfCities[index + 1] - currentCityCoOrdinate)
		maxDistance = abs(coOrdinatesOfCities[noOfCities - 1] - currentCityCoOrdinate)
	elif index == noOfCities - 1:
		minDistance = abs(coOrdinatesOfCities[index - 1] - currentCityCoOrdinate)
		maxDistance = abs(coOrdinatesOfCities[0] - currentCityCoOrdinate)
	else:
		minDistance = min(abs(coOrdinatesOfCities[index - 1] - currentCityCoOrdinate), abs(coOrdinatesOfCities[index + 1] - currentCityCoOrdinate))
		maxDistance = max(abs(coOrdinatesOfCities[0] - currentCityCoOrdinate), abs(coOrdinatesOfCities[noOfCities - 1] - currentCityCoOrdinate))
	print(minDistance, maxDistance)


num = int(input())
l1 = [int(x) for x in input().split()]
max1 = [abs(l1[0] - l1[-1])]
l3 = []
min1 = []
for city in l1[1:-1]:
	if abs(city - l1[0]) > abs(city - l1[-1]):
		max1.append(abs(city - l1[0]))
	else:
		max1.append(abs(city - l1[-1]))
max1.append(abs(l1[0] - l1[-1]))
for w in range(1, len(l1) - 1):
	if abs(l1[w] - l1[w - 1]) < abs(l1[w] - l1[w + 1]):
		min1.append(abs(l1[w] - l1[w - 1]))
	else:
		min1.append(abs(l1[w] - l1[w + 1]))
min1.insert(0, abs(l1[0] - l1[1]))
min1.append(abs(l1[-1] - l1[-2]))
l3 = zip(min1, max1)
for (x, y) in l3:
	print(x, y)


arg = int(input())
l1 = list(map(int, input().strip().split()))
minimum = l1[0]
maximum = l1[-1]
res = []
for i in range(0, len(l1)):
	if i == 0:
		t = [abs(l1[i] - l1[i + 1]), abs(l1[i] - maximum)]
	elif i == len(l1) - 1:
		t = [abs(l1[i] - l1[i - 1]), abs(l1[i] - minimum)]
	else:
		t = []
		t.append(min(abs(l1[i] - l1[i - 1]), abs(l1[i] - l1[i + 1])))
		t.append(max(abs(l1[i] - minimum), abs(l1[i] - maximum)))
	res.append(t)
for i in res:
	print(i[0], i[1])


def lineland(n):
	cities = [int(city) for city in input().split()]
	(lmc, rmc) = (cities[0], cities[len(cities) - 1])
	for _ in range(n):
		max_cost = max(abs(lmc - cities[_]), abs(rmc - cities[_]))
		try:
			min_cost = min(abs(cities[_ - 1] - cities[_]), abs(cities[_ + 1] - cities[_]))
		except:
			if _ == 0:
				min_cost = abs(cities[_ + 1] - cities[_])
			else:
				min_cost = abs(cities[_ - 1] - cities[_])
		print(min_cost, max_cost)

def main():
	n = int(input())
	lineland(n)
main()


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


numberOfCities = int(input())
cities = input()
cities_list = cities.split()
city_numbers = [int(x) for x in cities_list]
mini = 0
maxi = 0
for i in range(numberOfCities):
	if i == 0:
		mini = abs(city_numbers[1] - city_numbers[0])
		maxi = abs(city_numbers[numberOfCities - 1] - city_numbers[0])
	elif i == numberOfCities - 1:
		mini = abs(city_numbers[i] - city_numbers[i - 1])
		maxi = abs(city_numbers[i] - city_numbers[0])
	else:
		min1 = abs(city_numbers[i] - city_numbers[i - 1])
		min2 = abs(city_numbers[i] - city_numbers[i + 1])
		mini = min(min1, min2)
		max1 = abs(city_numbers[i] - city_numbers[0])
		max2 = abs(city_numbers[i] - city_numbers[numberOfCities - 1])
		maxi = max(max1, max2)
	print(mini, maxi)


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


numCities = int(input())
cities = input().split()
for index in range(len(cities)):
	cities[index] = int(cities[index])
for index in range(len(cities)):
	minCost = 0
	maxCost = 0
	if index == 0:
		minCost = abs(cities[index] - cities[1])
		maxCost = abs(cities[index] - cities[numCities - 1])
	elif index == numCities - 1:
		minCost = abs(cities[index] - cities[index - 1])
		maxCost = abs(cities[index] - cities[0])
	else:
		min1 = abs(cities[index] - cities[index + 1])
		min2 = abs(cities[index - 1] - cities[index])
		minCost = min(min1, min2)
		max1 = abs(cities[numCities - 1] - cities[index])
		max2 = abs(cities[0] - cities[index])
		maxCost = max(max1, max2)
	print(minCost, maxCost)


a = int(input())
l = list(map(int, input().split()))
for i in range(a):
	if i == 0:
		print(l[1] - l[0], l[-1] - l[0])
	elif i + 1 == a:
		print(l[-1] - l[-2], l[-1] - l[0])
	else:
		print(min(l[i] - l[i - 1], l[i + 1] - l[i]), end=' ')
		print(max(l[i] - l[0], l[-1] - l[i]))


n = int(input())
arr = [int(x) for x in input().split()]
for i in range(len(arr)):
	if i == 0:
		print(abs(arr[i] - arr[i + 1]), abs(arr[i] - arr[n - 1]))
	elif i == n - 1:
		print(abs(arr[i] - arr[n - 2]), abs(arr[i] - arr[0]))
	else:
		print(min(abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1])), max(abs(arr[i] - arr[0]), abs(arr[i] - arr[n - 1])))


def min(a, b):
	if a < b:
		return a
	else:
		return b

def max(a, b):
	if a > b:
		return a
	else:
		return b
n = int(input())
coor = [int(x) for x in input().split()]
mi = [0] * n
ma = [0] * n
for i in range(n):
	ma[i] = max(coor[n - 1] - coor[i], coor[i] - coor[0])
mi[0] = coor[1] - coor[0]
mi[n - 1] = coor[n - 1] - coor[n - 2]
for i in range(1, n - 1):
	mi[i] = min(coor[i] - coor[i - 1], coor[i + 1] - coor[i])
for i in range(n):
	print(mi[i], ma[i])


(n, m) = (int(input()), list(map(int, input().split())))
(pob, mi, mi_pob, ma, ma_pob) = ([], 0, 0, 0, 0)
print(abs(m[1] - m[0]), abs(m[n - 1] - m[0]))
for i in range(1, n - 1):
	(mi, mi_pob) = (abs(m[i - 1] - m[i]), abs(m[i + 1] - m[i]))
	pob.append(min(mi, mi_pob))
	(ma, ma_pob) = (abs(m[0] - m[i]), abs(m[n - 1] - m[i]))
	pob.append(max(ma, ma_pob))
for i in range(0, len(pob) - 1, 2):
	print(min(pob[i], pob[i + 1]), max(pob[i], pob[i + 1]))
print(abs(m[n - 2] - m[n - 1]), abs(m[0] - m[n - 1]))


q = input()
x = input()
x = x.split(' ')
arr = []
for i in x:
	arr.append(int(i))
arr2 = []
for i in range(len(arr)):
	if i == 0:
		min = abs(arr[i] - arr[i + 1])
		max = abs(arr[i] - arr[-1])
	elif i == len(arr) - 1:
		min = abs(arr[i] - arr[i - 1])
		max = abs(arr[i] - arr[0])
	else:
		min1 = abs(arr[i] - arr[i + 1])
		min2 = abs(arr[i] - arr[i - 1])
		if min1 > min2:
			min = min2
		else:
			min = min1
		max1 = abs(arr[i] - arr[-1])
		max2 = abs(arr[i] - arr[0])
		if max1 > max2:
			max = max1
		else:
			max = max2
	string = str(min) + ' ' + str(max)
	arr2.append(string)
for i in arr2:
	print(i)


linhas = int(input())
coordenadas = list(map(int, input().split()))
tamanho = len(coordenadas)
for i in range(tamanho):
	maxi = 0
	mini = 0
	if i != linhas - 1:
		maxi = max(abs(coordenadas[i] - coordenadas[0]), abs(coordenadas[i] - coordenadas[linhas - 1]))
		mini = min(abs(coordenadas[i] - coordenadas[i + 1]), abs(coordenadas[i] - coordenadas[i - 1]))
	else:
		maxi = coordenadas[linhas - 1] - coordenadas[0]
		mini = coordenadas[linhas - 1] - coordenadas[linhas - 2]
	print(mini, maxi)


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		m1 = abs(l[i + 1] - l[i])
		m2 = abs(l[n - 1] - l[i])
		print(m1, m2)
	elif i + 1 == n:
		m1 = abs(l[i] - l[i - 1])
		m2 = abs(l[i] - l[0])
		print(m1, m2)
	else:
		m1 = min(abs(l[i] - l[i - 1]), abs(l[i + 1] - l[i]))
		m2 = max(abs(l[n - 1] - l[i]), abs(l[i] - l[0]))
		print(m1, m2)


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


def mp():
	return map(int, input().split())

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def printlist(l):
	print(' '.join([str(x) for x in l]))

def min(a, b):
	if a > b:
		return b
	else:
		return a

def max(a, b):
	if a > b:
		return a
	else:
		return b
n = it()
a = lt()
for i in range(n):
	if i == 0:
		minn = a[1] - a[0]
		maxx = a[-1] - a[0]
	elif i == n - 1:
		minn = a[-1] - a[-2]
		maxx = a[-1] - a[0]
	else:
		minn = min(a[i] - a[i - 1], a[i + 1] - a[i])
		maxx = max(a[-1] - a[i], a[i] - a[0])
	printlist([minn, maxx])


num = int(input())
data = [int(i) for i in input().split()]
for i in range(num):
	h = max(abs(data[0] - data[i]), abs(data[-1] - data[i]))
	if i == 0:
		l = abs(data[1] - data[i])
	elif i == num - 1:
		l = abs(data[-2] - data[i])
	else:
		l = min(abs(data[i - 1] - data[i]), abs(data[i + 1] - data[i]))
	print(l, h)


n = int(input())
x = list(map(int, input().split()))
for (i, x_i) in enumerate(x):
	mi = min(abs(x_i - x[i - 1]), abs(x_i - x[(i + 1) % len(x)]))
	ma = max(abs(x_i - x[len(x) - 1]), abs(x_i - x[0]))
	print(mi, ma)


miest = int(input())
mesta = list(map(int, input().split()))
for i in range(miest):
	mesto = mesta[i]
	mini = min(abs(mesto - mesta[i - 1]), abs(mesto - mesta[i + 1 + (-2 if i == miest - 1 else 0)]))
	maxi = max(abs(mesto - mesta[0]), abs(mesto - mesta[-1]))
	print(mini, maxi)


n = int(input())
p = input().split(' ')
a = []
for i in p:
	a.append(int(i))
for i in range(0, n):
	if i == 0:
		print(str(a[1] - a[0]) + ' ' + str(a[n - 1] - a[0]))
	elif i == n - 1:
		print(str(a[n - 1] - a[n - 2]) + ' ' + str(a[n - 1] - a[0]))
	else:
		f1 = a[i + 1] - a[i]
		f2 = a[i] - a[i - 1]
		m1 = a[i] - a[0]
		m2 = a[n - 1] - a[i]
		print(str(min(f1, f2)) + ' ' + str(max(m1, m2)))


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


import math

def main():
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(len(a)):
		if i - 1 >= 0:
			temp1 = a[i - 1]
		else:
			temp1 = -math.inf
		if i + 1 < n:
			temp2 = a[i + 1]
		else:
			temp2 = math.inf
		ans1 = min(a[i] - temp1, temp2 - a[i])
		ans2 = max(a[i] - a[0], a[n - 1] - a[i])
		print(ans1, ans2)
	return
main()


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		mincost = a[i + 1] - a[i]
		maxcost = a[n - 1] - a[i]
	elif i == n - 1:
		mincost = a[i] - a[i - 1]
		maxcost = a[i] - a[0]
	else:
		mincost = min(a[i] - a[i - 1], a[i + 1] - a[i])
		maxcost = max(a[i] - a[0], a[n - 1] - a[i])
	print('%s %s' % (mincost, maxcost))


a = int(input())
l = list(map(int, input().split()))
print(abs(l[0] - l[1]), abs(l[-1] - l[0]))
for i in range(1, a - 1):
	x = abs(l[i] - l[0])
	y = abs(l[i] - l[-1])
	u = abs(l[i] - l[i - 1])
	v = abs(l[i] - l[i + 1])
	print(min(u, v), max(x, y))
print(abs(l[-1] - l[-2]), abs(l[-1] - l[0]))


import sys
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	if i > 0 and i < n - 1:
		mini = min(abs(x[i] - x[i + 1]), abs(x[i] - x[i - 1]))
		maxi = max(abs(x[i] - x[0]), abs(x[i] - x[n - 1]))
		print(mini, maxi)
	elif i == 0:
		print(abs(x[0] - x[1]), abs(x[0] - x[n - 1]))
	else:
		print(abs(x[n - 1] - x[n - 2]), abs(x[n - 1] - x[0]))


n = int(input())
l = [int(x) for x in input().split()]
for i in range(n):
	if i == 0:
		mi = abs(l[i] - l[i + 1])
		ma = abs(l[i] - l[n - 1])
	elif i == n - 1:
		mi = abs(l[i] - l[i - 1])
		ma = abs(l[i] - l[0])
	else:
		mi = min(abs(l[i] - l[i + 1]), abs(l[i] - l[i - 1]))
		ma = max(abs(l[i] - l[n - 1]), abs(l[i] - l[0]))
	print(mi, ma)


length = int(input())
numbers = [int(i) for i in input().split()]
minimum = []
maximum = []
for pos in range(len(numbers)):
	if pos == 0:
		minimum.append(numbers[pos + 1] - numbers[pos])
		maximum.append(numbers[-1] - numbers[pos])
	elif pos == len(numbers) - 1:
		minimum.append(numbers[pos] - numbers[pos - 1])
		maximum.append(numbers[pos] - numbers[0])
	else:
		minimum.append(min(numbers[pos] - numbers[pos - 1], numbers[pos + 1] - numbers[pos]))
		maximum.append(max(numbers[pos] - numbers[0], numbers[-1] - numbers[pos]))
for x in range(length):
	print(minimum[x], maximum[x])


n = int(input().strip())
arr = list(map(int, input().strip().split()))
for i in range(len(arr)):
	if i == 0:
		print(abs(arr[0] - arr[1]), abs(arr[0] - arr[-1]))
	elif i == n - 1:
		print(abs(arr[-1] - arr[-2]), abs(arr[-1] - arr[0]))
	else:
		mini = min(abs(arr[i - 1] - arr[i]), abs(arr[i + 1] - arr[i]))
		maxi = max(abs(arr[0] - arr[i]), abs(arr[-1] - arr[i]))
		print(mini, maxi)


n = int(input())
cordinates = [*map(int, input().split())]

def diff(a, b):
	return abs(a - b)
for i in range(n):
	nexti = i + 1
	backi = i - 1
	if backi >= 0 and nexti < n:
		d1 = diff(cordinates[backi], cordinates[i])
		d2 = diff(cordinates[i], cordinates[nexti])
		minv = min(d1, d2)
	elif backi < 0:
		minv = diff(cordinates[i], cordinates[nexti])
	else:
		minv = diff(cordinates[i], cordinates[backi])
	md1 = diff(cordinates[0], cordinates[i])
	md2 = diff(cordinates[n - 1], cordinates[i])
	maxv = max(md1, md2)
	print(minv, maxv)


n = int(input())
cits = list(map(int, input().split()))
sol = []
for i in range(n):
	mx = max(abs(cits[i] - cits[0]), abs(cits[i] - cits[-1]))
	if i == 0:
		mn = abs(cits[i] - cits[i + 1])
	elif i == n - 1:
		mn = abs(cits[i] - cits[i - 1])
	else:
		mn = min(abs(cits[i] - cits[i - 1]), abs(cits[i] - cits[i + 1]))
	sol.append([mn, mx])
for row in sol:
	print(*row)


from typing import List, Tuple

def parse_input() -> Tuple[int, List[int]]:
	return (int(input()), [int(x) for x in input().split()])

def solve(n: int, xs: List[int]) -> List[Tuple[int, int]]:
	answer = []
	for idx in range(n):
		if idx == 0:
			answer.append((xs[1] - xs[0], xs[-1] - xs[0]))
		elif idx == n - 1:
			answer.append((xs[-1] - xs[-2], xs[-1] - xs[0]))
		else:
			min_d = min(xs[idx + 1] - xs[idx], xs[idx] - xs[idx - 1])
			max_d = max(xs[idx] - xs[0], xs[-1] - xs[idx])
			answer.append((min_d, max_d))
	return answer
(n, xs) = parse_input()
for (x, y) in solve(n, xs):
	print(x, y)


x = int(input())
Getlist = input().split(' ')
Numlist = [int(i) for i in Getlist]
citylist = []
for k in range(len(Numlist)):
	if k == 0:
		citylist.append([Numlist[1] - Numlist[0], Numlist[-1] - Numlist[0]])
	elif k == len(Numlist) - 1:
		citylist.append([Numlist[k] - Numlist[k - 1], Numlist[k] - Numlist[0]])
	else:
		citylist.append([Numlist[k + 1] - Numlist[k], Numlist[k] - Numlist[k - 1], Numlist[k] - Numlist[0], Numlist[-1] - Numlist[k]])
for i in range(x):
	print(min(citylist[i]), max(citylist[i]))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
s = inlt()
print(s[1] - s[0], s[-1] - s[0])
for i in range(1, n - 1):
	m = min(s[i + 1] - s[i], s[i] - s[i - 1])
	M = max(s[i] - s[0], s[-1] - s[i])
	print(m, M)
print(s[-1] - s[-2], s[-1] - s[0])


n = int(input())
a = list(map(int, input().split(' ')))
for i in range(0, n):
	mins = min(abs(a[i] - a[i - 1]) if i > 0 else 10 ** 10, abs(a[i] - a[i + 1]) if i < n - 1 else 10 ** 10)
	maxs = max(abs(a[i] - a[0]), abs(a[i] - a[n - 1]))
	print(mins, maxs)


n = input()
cities = list(map(int, input().split()))
for i in range(len(cities)):
	if i == 0:
		print(abs(cities[i + 1] - cities[i]), abs(cities[-1] - cities[i]))
	elif i == len(cities) - 1:
		print(abs(cities[-2] - cities[-1]), abs(cities[0] - cities[-1]))
	else:
		min_distance = min(abs(cities[i + 1] - cities[i]), abs(cities[i - 1] - cities[i]))
		max_distance = max(abs(cities[0] - cities[i]), abs(cities[-1] - cities[i]))
		print(min_distance, max_distance)


n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	min_val = 1000000000000
	max_val = 0
	if i > 0:
		min_val = min(min_val, abs(arr[i - 1] - arr[i]))
	if i < n - 1:
		min_val = min(min_val, abs(arr[i + 1] - arr[i]))
	max_val = max(abs(arr[i] - arr[0]), abs(arr[i] - arr[n - 1]))
	print(min_val, max_val)


int(input())
l = list(map(int, input().split()))
mn = abs(min(l)) + abs(max(l))
mx = 0
for i in range(len(l)):
	if i != 0 and i != len(l) - 1:
		mn = min(abs(l[i] - l[i + 1]), abs(l[i] - l[i - 1]))
		mx = max(abs(l[i] - l[0]), abs(l[i] - l[-1]))
	elif i == 0:
		mn = abs(l[i] - l[i + 1])
		mx = abs(l[i] - l[-1])
	elif i == len(l) - 1:
		mn = abs(l[i] - l[i - 1])
		mx = abs(l[i] - l[0])
	print(mn, mx)


def minn(a, b):
	return a if a < b else b

def maxx(a, b):
	return a if a > b else b
n = int(input())
x = [y for y in map(int, input().split())]
print(x[1] - x[0], x[n - 1] - x[0])
for i in range(1, n - 1):
	print(minn(x[i + 1] - x[i], x[i] - x[i - 1]), maxx(x[n - 1] - x[i], x[i] - x[0]))
print(x[n - 1] - x[n - 2], x[n - 1] - x[0])


n = int(input())
cities = list(map(int, input().split()))
tmp1 = cities[1] - cities[0]
tmp3 = cities[-1] - cities[0]
print(str(tmp1) + ' ' + str(tmp3))
for i in range(1, n - 1):
	tmp2 = tmp1
	tmp1 = cities[i + 1] - cities[i]
	mi = min(tmp1, tmp2)
	ma = max(cities[i] - cities[0], cities[-1] - cities[i])
	print(str(mi) + ' ' + str(ma))
tmp4 = cities[-1] - cities[-2]
tmp5 = cities[-1] - cities[0]
print(str(tmp4) + ' ' + str(tmp5))


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		max1 = abs(a[n - 1] - a[0])
		min1 = abs(a[1] - a[0])
	elif i == n - 1:
		max2 = abs(a[n - 1] - a[0])
		min2 = abs(a[n - 1] - a[n - 2])
print(min1, end=' ')
print(max1)
mini = 0
maxi = 0
for i in range(1, n - 1):
	if abs(a[i + 1] - a[i]) <= abs(a[i] - a[i - 1]):
		mini = abs(a[i + 1] - a[i])
	else:
		mini = abs(a[i] - a[i - 1])
	if abs(a[0] - a[i]) >= abs(a[n - 1] - a[i]):
		maxi = abs(a[0] - a[i])
	else:
		maxi = abs(a[n - 1] - a[i])
	print(mini, end=' ')
	print(maxi)
print(min2, end=' ')
print(max2)


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


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()
print(lst[1] - lst[0], lst[-1] - lst[0])
for i in range(1, n - 1):
	print(min(lst[i + 1] - lst[i], lst[i] - lst[i - 1]), max(lst[-1] - lst[i], lst[i] - lst[0]))
print(lst[-1] - lst[-2], lst[-1] - lst[0])


from sys import stdin
n = int(stdin.readline().rstrip())
nums = list(map(int, stdin.readline().rstrip().split(' ')))
for i in range(len(nums)):
	cur = nums[i]
	mi = -1
	ma = -1
	if i == len(nums) - 1:
		mi = abs(cur - nums[i - 1])
		ma = abs(cur - nums[0])
	elif i == 0:
		mi = abs(cur - nums[1])
		ma = abs(cur - nums[-1])
	else:
		mi = min(abs(cur - nums[i + 1]), abs(nums[i - 1] - cur))
		ma = max(abs(cur - nums[-1]), abs(cur - nums[0]))
	print(mi, ma)


input()
a = list(map(int, input().split()))
for (i, x) in enumerate(a):
	X = ([x - a[0], x - a[i - 1]] if i > 0 else []) + ([a[-1] - x, a[i + 1] - x] if i + 1 < len(a) else [])
	print(min(X), max(X))


n = int(input())
arr = list(map(int, input().split()))
for (ind, el) in enumerate(arr):
	if ind == 0:
		max_distance = abs(el - arr[n - 1])
		min_distance = abs(el - arr[1])
	elif ind == n - 1:
		max_distance = abs(el - arr[0])
		min_distance = abs(el - arr[n - 2])
	else:
		max_distance = max(abs(el - arr[0]), abs(el - arr[n - 1]))
		min_distance = min(abs(el - arr[ind + 1]), abs(el - arr[ind - 1]))
	print(min_distance, max_distance)


n = int(input())
x = [int(x) for x in input().split()]
l = x[0]
r = x[-1]
for i in range(n):
	if i == 0:
		g = r - l
		s = x[1] - l
	elif i == n - 1:
		g = r - l
		s = x[-1] - x[-2]
	else:
		if abs(x[i] - l) >= abs(r - x[i]):
			g = x[i] - l
		else:
			g = r - x[i]
		if abs(x[i] - x[i - 1]) <= abs(x[i + 1] - x[i]):
			s = x[i] - x[i - 1]
		else:
			s = x[i + 1] - x[i]
	print(abs(s), abs(g))


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


n = int(input())
data = [int(i) for i in input().split()]
p = []
for i in range(n):
	p.append([data[i], i])
mini = [0 for i in range(n)]
maxi = [0 for i in range(n)]
mini[p[0][1]] = abs(p[0][0] - p[1][0])
maxi[p[0][1]] = abs(p[-1][0] - p[0][0])
mini[p[-1][1]] = abs(p[-1][0] - p[-2][0])
maxi[p[-1][1]] = abs(p[-1][0] - p[0][0])
for i in range(1, n - 1):
	mini[p[i][1]] = min(abs(p[i][0] - p[i - 1][0]), abs(p[i][0] - p[i + 1][0]))
	maxi[p[i][1]] = max(abs(p[i][0] - p[0][0]), abs(p[i][0] - p[-1][0]))
for i in range(n):
	print(mini[i], maxi[i])


n = int(input())
cities = [int(x) for x in input().split()]
minimum = [0] * n
maximum = [0] * n
for i in range(n):
	if i == 0:
		minimum[i] = cities[i + 1] - cities[i]
	elif i == n - 1:
		minimum[i] = cities[i] - cities[i - 1]
	else:
		minimum[i] = min(cities[i + 1] - cities[i], cities[i] - cities[i - 1])
	maximum[i] = max(cities[i] - cities[0], cities[n - 1] - cities[i])
for i in range(n):
	print('%d %d' % (minimum[i], maximum[i]))


n = int(input().strip())
x = tuple(map(int, input().strip().split(' ')))
print('{} {}'.format(str(x[1] - x[0]), str(x[n - 1] - x[0])))
for i in range(1, n - 1):
	print('{} {}'.format(min(x[i] - x[i - 1], x[i + 1] - x[i]), max(x[i] - x[0], x[n - 1] - x[i])))
print('{} {}'.format(x[n - 1] - x[n - 2], x[n - 1] - x[0]))


n = int(input())
xn = []
entry = input().split()
for i in range(len(entry)):
	xn.append(int(entry[i]))
for i in range(n):
	if i == 0:
		min = xn[1] - xn[0]
		max = xn[n - 1] - xn[0]
	elif i == n - 1:
		min = xn[n - 1] - xn[n - 2]
		max = xn[n - 1] - xn[0]
	else:
		min = xn[i] - xn[i - 1]
		if xn[i + 1] - xn[i] < min:
			min = xn[i + 1] - xn[i]
		max = xn[n - 1] - xn[i]
		if xn[i] - xn[0] > max:
			max = xn[i] - xn[0]
	print(str(min) + ' ' + str(max))


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(n):
	if i == 0:
		mi = l[1] - l[0]
	elif i == n - 1:
		mi = l[n - 1] - l[n - 2]
	else:
		mi = min(l[i + 1] - l[i], l[i] - l[i - 1])
	ma = max(l[n - 1] - l[i], l[i] - l[0])
	print(mi, ma)


n = int(input())
li = list(map(int, input().split()))
first = li[0]
last = li[-1]
for i in range(n):
	if i == 0:
		print(abs(first - li[1]), abs(last - first))
	elif i == n - 1:
		print(abs(last - li[-2]), abs(first - last))
	else:
		mi = 10 ** 11
		mi = min(mi, abs(li[i] - li[i - 1]))
		mi = min(mi, abs(li[i] - li[i + 1]))
		ma = 0
		ma = max(ma, abs(li[i] - first))
		ma = max(ma, abs(li[i] - last))
		print(mi, ma)


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


import sys

def main():
	n = int(input())
	coords = [int(x) for x in input().split()]
	for i in range(len(coords)):
		if i == 0:
			min_cost = coords[1] - coords[0]
			max_cost = coords[-1] - coords[0]
		elif i == len(coords) - 1:
			min_cost = coords[-1] - coords[-2]
			max_cost = coords[-1] - coords[0]
		else:
			min_cost = min(abs(coords[i] - coords[i - 1]), abs(coords[i] - coords[i + 1]))
			max_cost = max(abs(coords[i] - coords[0]), abs(coords[i] - coords[-1]))
		print(min_cost, max_cost)
main()


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


n = int(input())
a = [int(i) for i in input().split()]
dist = [a[i] - a[i - 1] for i in range(1, n)]
for i in range(n):
	if i == 0:
		print(str(dist[0]) + ' ' + str(a[-1] - a[0]))
	elif i == n - 1:
		print(str(dist[n - 2]) + ' ' + str(a[-1] - a[0]))
	else:
		print(str(min(dist[i - 1], dist[i])) + ' ' + str(max(a[i] - a[0], a[-1] - a[i])))


N = int(input())
X = list(map(int, input().split(' ')))

def min_cost(i):
	if i == 0:
		return X[1] - X[0]
	if i == N - 1:
		return X[N - 1] - X[N - 2]
	return min(X[i] - X[i - 1], X[i + 1] - X[i])

def max_cost(i):
	return max(X[i] - X[0], X[N - 1] - X[i])
for (i, x) in enumerate(X):
	print(min_cost(i), max_cost(i))


import sys
import math
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	(min_d, max_d) = (3000000000.0, -3000000000.0)
	if i - 1 >= 0:
		min_d = min(min_d, abs(a[i] - a[i - 1]))
	if i + 1 < n:
		min_d = min(min_d, abs(a[i] - a[i + 1]))
	max_d = max(max_d, abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(min_d, max_d)


n = int(input())
l = [int(i) for i in input().split()]
for i in range(n):
	if i < n - 1 and i > 0:
		print(min(abs(l[i] - l[i - 1]), abs(l[i + 1] - l[i])), max(abs(l[i] - l[0]), abs(l[n - 1] - l[i])), sep=' ')
	elif i == n - 1:
		print(abs(l[n - 1] - l[n - 2]), abs(l[n - 1] - l[0]), sep=' ')
	elif i == 0:
		print(abs(l[1] - l[0]), abs(l[n - 1] - l[0]), sep=' ')


n = int(input())
l = [int(i) for i in input().split()]
print(l[1] - l[0], l[-1] - l[0])
for i in range(1, n - 1):
	if l[i] - l[i - 1] < l[i + 1] - l[i]:
		print(l[i] - l[i - 1], '', end='')
	else:
		print(l[i + 1] - l[i], '', end='')
	if l[i] - l[0] > l[-1] - l[i]:
		print(l[i] - l[0])
	else:
		print(l[-1] - l[i])
print(l[-1] - l[-2], l[-1] - l[0])


size = int(input())
arr = input().split()
arr = [int(x) for x in arr]
for i in range(size):
	menor = 0
	maior = 0
	if i == 0:
		menor = arr[i] - arr[i + 1]
		maior = arr[i] - arr[size - 1]
	elif i == size - 1:
		menor = arr[i] - arr[i - 1]
		maior = arr[i] - arr[0]
	else:
		if abs(arr[i] - arr[i - 1]) > abs(arr[i] - arr[i + 1]):
			menor = arr[i] - arr[i + 1]
		else:
			menor = arr[i] - arr[i - 1]
		if abs(arr[i] - arr[0]) > abs(arr[i] - arr[size - 1]):
			maior = arr[i] - arr[0]
		else:
			maior = arr[i] - arr[size - 1]
	print('{} {}'.format(abs(menor), abs(maior)))


n = int(input())
x = [int(i) for i in input().split()]
for i in range(n - 1):
	min1 = min([abs(x[i - 1] - x[i]), abs(x[i + 1] - x[i])])
	max1 = max([abs(x[i] - x[0]), abs(x[i] - x[-1])])
	print(min1, max1)
print(min([abs(x[n - 2] - x[-1]), abs(x[0] - x[-1])]), max([abs(x[-1] - x[0]), abs(x[-1] - x[n - 2])]))


import sys
from math import ceil, log, gcd, sqrt
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('Yes')

def NO():
	print('No')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
a = RI()
a.sort()
maxx = []
for i in range(0, len(a)):
	if i == 0:
		maxx.append(a[-1] - a[i])
	elif i == len(a) - 1:
		maxx.append(a[i] - a[0])
	else:
		maxx.append(max(a[i] - a[0], a[-1] - a[i]))
a = [-INF] + a + [INF]
minn = []
for i in range(1, len(a) - 1):
	minn.append(min(a[i] - a[i - 1], a[i + 1] - a[i]))
for i in range(n):
	print(minn[i], maxx[i])


n = int(input())
cities = [int(x) for x in input().split()]
answer = {}
answer[0] = list([abs(cities[0] - cities[1])])
for i in range(1, n - 1):
	answer[i] = list([min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))])
	answer[i].append(max(abs(cities[i] - cities[0]), abs(cities[i] - cities[n - 1])))
answer[n - 1] = list([abs(cities[n - 1] - cities[n - 2])])
answer[0].append(abs(cities[0] - cities[n - 1]))
answer[n - 1].append(abs(cities[0] - cities[n - 1]))
for (k, v) in answer.items():
	print(*v, sep=' ')


n = int(input())
arr = input().split(' ')
print(str(int(arr[1]) - int(arr[0])) + ' ' + str(int(arr[len(arr) - 1]) - int(arr[0])))
for i in range(1, n - 1):
	longdistarr = [int(arr[i]) - int(arr[0]), int(arr[len(arr) - 1]) - int(arr[i])]
	shortdistarr = [int(arr[i]) - int(arr[i - 1]), int(arr[i + 1]) - int(arr[i])]
	if shortdistarr[0] < shortdistarr[1]:
		print(shortdistarr[0], end=' ')
	else:
		print(shortdistarr[1], end=' ')
	if longdistarr[0] > longdistarr[1]:
		print(longdistarr[0])
	else:
		print(longdistarr[1])
print(int(arr[len(arr) - 1]) - int(arr[len(arr) - 2]), end=' ')
print(int(arr[len(arr) - 1]) - int(arr[0]))


x = int(input())
y = list(map(int, input().split()))
minmax = []
for i in range(x):
	ma = max(abs(y[i] - y[0]), abs(y[i] - y[-1]))
	if i == 0:
		mn = abs(y[i] - y[i + 1])
	elif i == x - 1:
		mn = abs(y[-1] - y[i - 1])
	else:
		mn = min(abs(y[i] - y[i + 1]), abs(y[i] - y[i - 1]))
	minmax.append([mn, ma])
for r in minmax:
	print(*r)


n = int(input())
arr = [int(i) for i in input().split(' ')]
arr.sort()
for i in range(n):
	if i == 0:
		(x, y) = (abs(arr[0] - arr[1]), abs(arr[0] - arr[n - 1]))
		print(min(x, y), max(x, y))
	elif i == n - 1:
		(x, y) = (abs(arr[n - 2] - arr[n - 1]), abs(arr[0] - arr[n - 1]))
		print(min(x, y), max(x, y))
	else:
		(x, y) = (abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1]))
		(w, z) = (abs(arr[i] - arr[0]), abs(arr[i] - arr[n - 1]))
		print(min(x, y, w, z), max(x, y, w, z))


import math
n_cities = int(input())
distances = list(map(int, input().split(' ')))
max_ = 0
min_ = 0

def euclideanDistance(p1, p2):
	return int(math.sqrt((p2 - p1) ** 2))
for i in range(n_cities):
	if i == 0:
		min_ = euclideanDistance(distances[0], distances[1])
		max_ = euclideanDistance(distances[0], distances[n_cities - 1])
	elif i == n_cities - 1:
		min_ = euclideanDistance(distances[i], distances[i - 1])
		max_ = euclideanDistance(distances[i], distances[0])
	else:
		right_neigh = euclideanDistance(distances[i], distances[i + 1])
		left_neigh = euclideanDistance(distances[i], distances[i - 1])
		min_ = min(right_neigh, left_neigh)
		finish_distance = euclideanDistance(distances[i], distances[n_cities - 1])
		begining_distance = euclideanDistance(distances[i], distances[0])
		max_ = max(finish_distance, begining_distance)
	print(min_, max_)


from sys import stdin
n = int(stdin.readline())
l = list(map(int, stdin.readline().split()))
for i in range(n):
	minimum = abs(l[i] - l[i - 1])
	if i != n - 1:
		minimum = min(abs(l[i] - l[i - 1]), abs(l[i] - l[i + 1]))
	maximum = max(abs(l[i] - l[0]), abs(l[i] - l[n - 1]))
	print(minimum, maximum)


x = int(input())
l = []
for x in map(int, input().split()):
	l.append(x)
z = 0
while z < len(l):
	if z == 0:
		print(abs(l[z] - l[z + 1]), abs(l[z] - l[-1]))
	elif z == len(l) - 1:
		print(abs(l[z] - l[z - 1]), abs(l[z] - l[0]))
	else:
		print(min(abs(l[z] - l[z - 1]), abs(l[z] - l[z + 1])), max(abs(l[0] - l[z]), abs(l[-1] - l[z])))
	z += 1


from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 15

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()

def main():
	n = int(input())
	a = list(map(int, input().split()))
	city = list(enumerate(a))
	city.sort(key=lambda x: x[1])
	d = defaultdict(list)
	(mn, mx) = (city[0][1], city[-1][1])
	d[city[0][0]].append(city[1][1] - mn)
	d[city[0][0]].append(mx - mn)
	d[city[-1][0]].append(mx - city[-2][1])
	d[city[-1][0]].append(mx - mn)
	for i in range(1, n - 1):
		d[city[i][0]].append(min(city[i][1] - city[i - 1][1], city[i + 1][1] - city[i][1]))
		d[city[i][0]].append(max(mx - city[i][1], city[i][1] - mn))
	for i in range(n):
		print(' '.join(map(str, d[i])))
main()


n = int(input())
a = [int(x) for x in input().split()]
print(abs(a[0] - a[1]), abs(a[0] - a[n - 1]))
for i in range(1, n - 1):
	mintmp1 = abs(a[i] - a[i - 1])
	mintmp2 = abs(a[i] - a[i + 1])
	if mintmp2 > mintmp1:
		mintmp = mintmp1
	else:
		mintmp = mintmp2
	maxtmp1 = abs(a[i] - a[n - 1])
	maxtmp2 = abs(a[i] - a[0])
	if maxtmp2 > maxtmp1:
		maxtmp = maxtmp2
	else:
		maxtmp = maxtmp1
	print(mintmp, maxtmp)
print(abs(a[n - 2] - a[n - 1]), abs(a[n - 1] - a[0]))


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


n = int(input())
points = list(map(int, input().split()))
points.sort()
result = []

def findMinMax(ps, val, index):
	if index == 0:
		mn = abs(val - ps[index + 1])
		mx = abs(val - ps[-1])
	elif val == ps[-1]:
		mn = abs(val - ps[index - 1])
		mx = abs(val - ps[0])
	else:
		mx = max(abs(val - ps[0]), abs(val - ps[-1]))
		mn = min(abs(val - ps[index - 1]), abs(val - ps[index + 1]))
	return (mn, mx)
for i in range(n):
	(mn, mx) = findMinMax(points, points[i], i)
	result.append([mn, mx])
for i in result:
	print(i[0], i[1])


n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(arr[1] - arr[0], arr[n - 1] - arr[0])
	elif i == n - 1:
		print(arr[n - 1] - arr[n - 2], arr[n - 1] - arr[0])
	else:
		if arr[i + 1] - arr[i] <= arr[i] - arr[i - 1]:
			print(arr[i + 1] - arr[i], end=' ')
		else:
			print(arr[i] - arr[i - 1], end=' ')
		if arr[n - 1] - arr[i] >= arr[i] - arr[0]:
			print(arr[n - 1] - arr[i])
		else:
			print(arr[i] - arr[0])


N = int(input())
cities = [int(x) for x in input().split()]
for i in range(N):
	maxcost = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[N - 1]))
	if i == 0:
		mincost = abs(cities[i] - cities[i + 1])
	elif i == N - 1:
		mincost = abs(cities[i] - cities[i - 1])
	else:
		mincost = min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))
	print(mincost, maxcost)


quantidade_cidades = int(input())
cidades = list(map(int, input().split()))
cidade_min = cidades[0]
cidade_max = cidades[-1]
retorno = []
for i in range(len(cidades)):
	if i == len(cidades) - 1:
		print(abs(cidades[-2] - cidades[i]), abs(cidades[0] - cidades[i]))
		continue
	minimo = abs(cidades[i + 1] - cidades[i]) if abs(cidades[i - 1] - cidades[i]) > abs(cidades[i + 1] - cidades[i]) else abs(cidades[i - 1] - cidades[i])
	maximo = abs(cidades[0] - cidades[i]) if abs(cidades[0] - cidades[i]) > abs(cidades[-1] - cidades[i]) else abs(cidades[-1] - cidades[i])
	print(minimo, maximo)


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


from math import sqrt
n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
	if i == 0:
		MAX = sqrt((a[-1] - a[0]) ** 2)
		MIN = sqrt((a[1] - a[0]) ** 2)
		print(int(MIN), int(MAX))
	elif i == n - 1:
		MAX = sqrt((a[0] - a[-1]) ** 2)
		MIN = sqrt((a[-2] - a[-1]) ** 2)
		print(int(MIN), int(MAX))
	else:
		start = sqrt((a[0] - a[i]) ** 2)
		end = sqrt((a[-1] - a[i]) ** 2)
		if start > end:
			MAX = start
		else:
			MAX = end
		left = sqrt((a[i - 1] - a[i]) ** 2)
		right = sqrt((a[i + 1] - a[i]) ** 2)
		if left > right:
			MIN = right
		else:
			MIN = left
		print(int(MIN), int(MAX))


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


n = int(input())
arr = list(map(int, input().strip().split()))
l = 0
h = n - 1
ans = []
for i in range(n):
	mi = 10000000000000000000
	if i + 1 != n:
		mi = min(mi, abs(arr[i + 1] - arr[i]))
	if i - 1 != -1:
		mi = min(mi, abs(arr[i - 1] - arr[i]))
	ma = 0
	ma = max(ma, abs(arr[i] - arr[0]))
	ma = max(ma, abs(arr[i] - arr[n - 1]))
	ans.append([mi, ma])
for i in range(n):
	print(*ans[i])


from math import sqrt as rt
n = int(input())
x = list(map(int, input().split()))
md = int(rt((x[0] - x[-1]) ** 2))
for i in range(n):
	if i == 0:
		print(int(rt((x[i] - x[i + 1]) ** 2)), md)
	elif i == n - 1:
		print(int(rt((x[i] - x[i - 1]) ** 2)), md)
	else:
		print(min(int(rt((x[i] - x[i - 1]) ** 2)), int(rt((x[i] - x[i + 1]) ** 2))), max(int(rt((x[i] - x[0]) ** 2)), int(rt((x[i] - x[-1]) ** 2))))


x = int(input())
p = list(map(int, input().split()))
for i in range(x):
	if i == 0:
		print(abs(p[1] - p[0]), abs(p[x - 1] - p[0]))
		continue
	if i == x - 1:
		print(abs(p[x - 1] - p[x - 2]), abs(p[x - 1] - p[0]))
		continue
	print(min(abs(p[i] - p[i + 1]), abs(p[i] - p[i - 1])), max(abs(p[x - 1] - p[i]), abs(p[0] - p[i])))


n = int(input())
a = [int(n) for n in input().split(' ')]
for i in range(len(a)):
	if i == 0:
		mi = abs(a[1] - a[0])
		ma = abs(a[-1] - a[0])
	elif i == len(a) - 1:
		mi = abs(a[i] - a[i - 1])
		ma = abs(a[-1] - a[0])
	else:
		mi = min(abs(a[i] - a[i - 1]), abs(a[i + 1] - a[i]))
		ma = max(abs(a[i] - a[0]), abs(a[-1] - a[i]))
	print(str(mi) + ' ' + str(ma))


nCitys = int(input())
citysVector = input().split()

def my_function(index, vector):
	shortestWay = 0
	longestWay = 0
	number = int(vector[index])
	if index == 0:
		shortestWay = abs(number - int(vector[1]))
		longestWay = abs(number - int(vector[len(vector) - 1]))
	elif index == len(vector) - 1:
		shortestWay = abs(number - int(vector[index - 1]))
		longestWay = abs(number - int(vector[0]))
	else:
		leftNumber = int(vector[index - 1])
		rightNumber = int(vector[index + 1])
		if abs(leftNumber - number) >= abs(rightNumber - number):
			shortestWay = abs(rightNumber - number)
		else:
			shortestWay = abs(number - leftNumber)
		if abs(number - int(vector[len(vector) - 1])) >= abs(number - int(vector[0])):
			longestWay = abs(number - int(vector[len(vector) - 1]))
		else:
			longestWay = abs(number - int(vector[0]))
	return str(shortestWay) + ' ' + str(longestWay)
for i in range(0, len(citysVector), 1):
	print(my_function(i, citysVector))


s = int(input())
a = [int(i) for i in input().split()]
print(abs(a[0] - a[1]), abs(a[len(a) - 1] - a[0]))
for i in range(1, len(a) - 1):
	d = min(abs(a[i] - a[i + 1]), abs(a[i] - a[i - 1]))
	e = max(abs(a[i] - a[0]), abs(a[i] - a[len(a) - 1]))
	print(d, e)
print(abs(a[len(a) - 1] - a[len(a) - 2]), abs(a[len(a) - 1] - a[0]))


n = int(input())
x = list(map(int, input().strip().split(' ')))
if n == 2:
	print(x[1] - x[0], x[1] - x[0])
	print(x[1] - x[0], x[1] - x[0])
else:
	ans = str(x[1] - x[0]) + ' ' + str(x[-1] - x[0]) + '\n'
	for i in range(1, n - 1):
		ans += str(min(x[i] - x[i - 1], x[i + 1] - x[i])) + ' ' + str(max(x[i] - x[0], x[-1] - x[i])) + '\n'
	ans += str(x[-1] - x[-2]) + ' ' + str(x[-1] - x[0])
	print(ans)


n = int(input())
number_array = input()
lst = list(map(int, number_array.split()))
lst.insert(0, lst[1])
lst.append(lst[n - 1])
for i in range(1, n + 1, 1):
	print(min(abs(lst[i] - lst[i - 1]), abs(lst[i] - lst[i + 1])), end=' ')
	print(max(abs(lst[i] - lst[1]), abs(lst[i] - lst[n])))


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


n = int(input())
cities = list(map(int, input().split()))
d_min = cities[1] - cities[0]
d_max = cities[-1] - cities[0]
print(d_min, d_max)
for i in range(1, n - 1):
	d_min = min(abs(cities[i] - cities[i - 1]), abs(cities[i] - cities[i + 1]))
	d_max = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[-1]))
	print(d_min, d_max)
print(abs(cities[-1] - cities[-2]), abs(cities[-1] - cities[0]))


n = int(input())
l = list(map(int, input().split()))
(left, right) = (l[0], l[n - 1])
for i in range(n):
	if i == 0:
		imin = abs(l[i] - l[i + 1])
	elif i == n - 1:
		imin = abs(l[i] - l[i - 1])
	else:
		imin = min(abs(l[i] - l[i - 1]), abs(l[i] - l[i + 1]))
	imax = max(abs(l[i] - left), abs(l[i] - right))
	print(imin, imax)


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


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


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


cts = int(input())
cods = list(map(int, input().split(' ')))
for i in range(cts):
	cst = []
	if i == 0:
		cst.append(str(abs(cods[1] - cods[0])))
		cst.append(str(abs(cods[-1] - cods[0])))
	elif i == len(cods) - 1:
		cst.append(str(abs(cods[-2] - cods[-1])))
		cst.append(str(abs(cods[0] - cods[-1])))
	else:
		cst.append(str(min(abs(cods[i - 1] - cods[i]), abs(cods[i + 1] - cods[i]))))
		cst.append(str(max(abs(cods[0] - cods[i]), abs(cods[-1] - cods[i]))))
	print(' '.join(cst))


def ii():
	return int(input())

def ss():
	return [x for x in input()]

def si():
	return [int(x) for x in input().split()]

def mi():
	return map(int, input().split())
a = ii()
s = si()
print(s[1] - s[0], s[-1] - s[0])
for i in range(1, a - 1):
	print(min(s[i + 1] - s[i], s[i] - s[i - 1]), max(s[-1] - s[i], s[i] - s[0]))
print(s[-1] - s[-2], s[-1] - s[0])


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	maxx = max(abs(l[i] - l[-1]), abs(l[0] - l[i]))
	minn = min(abs(l[i] - l[(i + 1) % n]), abs(l[i - 1] - l[i]))
	print(f'{minn} {maxx}')


import time
n = int(input())
x = [int(i) for i in input().split()]
start = time.time()
print(x[1] - x[0], x[n - 1] - x[0])
for i in range(1, n - 1):
	min_i = min(x[i] - x[i - 1], x[i + 1] - x[i])
	max_i = max(x[i] - x[0], x[n - 1] - x[i])
	print(min_i, max_i)
print(x[n - 1] - x[n - 2], x[n - 1] - x[0])
finish = time.time()


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


n = int(input())
p = [int(x) for x in input().split()]
for (k, v) in enumerate(p):
	(mi, ma) = (0, 0)
	if k == 0:
		(mi, ma) = (p[k + 1] - p[k], p[n - 1] - p[k])
	elif k == n - 1:
		(mi, ma) = (p[k] - p[k - 1], p[k] - p[0])
	else:
		(mi, ma) = (min(p[k + 1] - p[k], p[k] - p[k - 1]), max(p[k] - p[0], p[n - 1] - p[k]))
	print('{} {}'.format(mi, ma))


N = int(input())
X = list(map(int, input().split()))
X.sort()
for i in range(N):
	if i == 0:
		minv = X[i + 1] - X[i]
		maxv = X[-1] - X[i]
	elif i == N - 1:
		minv = X[i] - X[i - 1]
		maxv = X[i] - X[0]
	else:
		minv = min(X[i] - X[i - 1], X[i + 1] - X[i])
		maxv = max(X[i] - X[0], X[-1] - X[i])
	print('{} {}'.format(minv, maxv))


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


n = int(input())
xs = sorted(map(int, input().split()))
INF = 10000000000.0
for (i, x) in enumerate(xs):
	min_cost = min((abs(x - xs[i - 1]) if i > 0 else INF, abs(x - xs[i + 1]) if i < n - 1 else INF))
	max_cost = max(x - xs[0], xs[n - 1] - x)
	print('{} {}'.format(min_cost, max_cost))


num = int(input())
a = list(map(int, input().split()))
for i in range(num):
	if i == 0:
		print(a[1] - a[0], a[num - 1] - a[0])
	elif i == num - 1:
		print(a[num - 1] - a[num - 2], a[num - 1] - a[0])
	else:
		if a[i] - a[i - 1] > a[i + 1] - a[i]:
			m0 = a[i + 1] - a[i]
		else:
			m0 = a[i] - a[i - 1]
		if a[i] - a[0] > a[num - 1] - a[i]:
			m1 = a[i] - a[0]
		else:
			m1 = a[num - 1] - a[i]
		print(m0, m1)


x1 = input()
x = [int(i) for i in input().split()]
print(str(abs(x[0] - x[1])) + ' ' + str(abs(x[0] - x[-1])))
for nums in range(1, len(x) - 1):
	print(str(min(abs(x[nums] - x[nums - 1]), abs(x[nums] - x[nums + 1]))) + ' ' + str(max(abs(x[nums] - x[-1]), abs(x[nums] - x[0]))))
print(str(abs(x[-1] - x[-2])) + ' ' + str(abs(x[-1] - x[0])))


def meu_map(lista):
	lista_mapeada = []
	for e in lista:
		lista_mapeada.append(int(e))
	return lista_mapeada

def max_i(lista, i):
	if i == 0:
		maximo = -lista[i] + lista[-1]
	elif i == len(lista) - 1:
		maximo = -lista[0] + lista[i]
	else:
		direita = -lista[i] + lista[-1]
		esquerda = -lista[0] + lista[i]
		maximo = max(direita, esquerda)
	return maximo

def min_i(lista, i):
	if i == 0:
		minimo = -lista[i] + lista[i + 1]
	elif i == len(lista) - 1:
		minimo = -lista[i - 1] + lista[i]
	else:
		direita = -lista[i] + lista[i + 1]
		esquerda = -lista[i - 1] + lista[i]
		minimo = min(direita, esquerda)
	return minimo
n = int(input())
cidades = meu_map(input().split())
for i in range(n):
	print(min_i(cidades, i), max_i(cidades, i))


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


n = int(input())
a = [int(c) for c in input().split()]
a = [-3 * 10 ** 9] + a + [3 * 10 ** 9]
for i in range(1, n + 1):
	print('%d %d' % (min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1])), max(abs(a[i] - a[1]), abs(a[i] - a[-2]))))


n = int(input())
line = str(input()).split()
line = [int(it) for it in line]
for i in range(n):
	if i == 0:
		min_it = str(line[i + 1] - line[i])
		max_it = str(line[n - 1] - line[i])
		print(min_it + ' ' + max_it)
	elif i == n - 1:
		min_it = str(line[i] - line[i - 1])
		max_it = str(line[i] - line[0])
		print(min_it + ' ' + max_it)
	else:
		min_it = str(min(line[i + 1] - line[i], line[i] - line[i - 1]))
		max_it = str(max(line[n - 1] - line[i], line[i] - line[0]))
		print(min_it + ' ' + max_it)


n = int(input())
cities = list(map(int, input().split(' ')))
ans = []
min_city_distance = min(cities)
max_city_distance = max(cities)
ans.append([abs(cities[0] - cities[1]), abs(cities[0] - max_city_distance)])
for i in range(1, len(cities) - 1):
	temp = []
	min_diff = min(abs(cities[i] - cities[i - 1]), abs(cities[i] - cities[i + 1]))
	max_diff = max(abs(cities[i] - max_city_distance), abs(cities[i] - min_city_distance))
	temp.append(min_diff)
	temp.append(max_diff)
	ans.append(temp)
ans.append([abs(cities[-1] - cities[-2]), abs(cities[-1] - min_city_distance)])
for city_send_letter_cost in ans:
	print('{} {}'.format(min(city_send_letter_cost), max(city_send_letter_cost)))


import math
import sys

def ri():
	return input()

def ii():
	return int(input())

def li():
	return input().split()

def mi():
	return list(map(int, input().split()))
n = ii()
x = mi()
for i in range(n):
	ans = []
	if i == n - 1:
		ans.append(str(abs(x[i] - x[i - 1])))
		ans.append(str(abs(x[i] - x[0])))
	else:
		ans.append(str(min(abs(x[i] - x[i - 1]), abs(x[i] - x[i + 1]))))
		ans.append(str(max(abs(x[i] - x[0]), abs(x[i] - x[-1]))))
	print(' '.join(ans))


n = int(input())
coords = list(map(int, input().split()))
max_ = max(coords)
min_ = min(coords)
mins = list()
for (i, x) in enumerate(coords):
	if i == 0:
		mins.append(coords[1] - coords[0])
	elif i == n - 1:
		mins.append(coords[-1] - coords[-2])
	else:
		mins.append(min(coords[i + 1] - x, x - coords[i - 1]))
maxs = [max(max_ - x, x - min_) for x in coords]
for (u, v) in zip(mins, maxs):
	print(u, v)


n = int(input())
arr = list(map(int, input().split()))
(mini, maxi) = (0, 0)
for x in range(n):
	mini = min(abs(arr[x] - arr[x - 1]), abs(arr[(x + 1) % len(arr)] - arr[x]))
	maxi = max(arr[x] - arr[0], arr[-1] - arr[x])
	print(mini, maxi)


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


n = input()
n = int(n)
cidades = list(map(int, input().split()))
for i in range(n):
	(min, max)
	max1 = cidades[i] - cidades[0]
	max1 = max1 if max1 > 0 else max1 * -1
	max2 = cidades[i] - cidades[n - 1]
	max2 = max2 if max2 > 0 else max2 * -1
	max = max1 if max1 > max2 else max2
	if i != 0:
		min1 = cidades[i] - cidades[i - 1]
		min1 = min1 if min1 > 0 else min1 * -1
	else:
		min1 = -1
	if i != n - 1:
		min2 = cidades[i] - cidades[i + 1]
		min2 = min2 if min2 > 0 else min2 * -1
	else:
		min2 = -1
	min = min1 if min2 == -1 or (min1 < min2 and min1 != -1) else min2
	print(min, max)


p = input()

def inp(s):
	j = 0
	a = []
	for i in range(len(s)):
		if s[i] == ' ':
			a.append(int(s[j:i]))
			j = i + 1
		if i == len(s) - 1:
			a.append(int(s[j:]))
	return a
s = input()
a = inp(s)
print(a[1] - a[0], a[len(a) - 1] - a[0])
for i in range(1, len(a) - 1):
	if a[i] - a[i - 1] >= a[i + 1] - a[i] and a[i] - a[0] >= a[len(a) - 1] - a[i]:
		print(a[i + 1] - a[i], a[i] - a[0])
	elif a[i] - a[i - 1] < a[i + 1] - a[i] and a[i] - a[0] >= a[len(a) - 1] - a[i]:
		print(a[i] - a[i - 1], a[i] - a[0])
	elif a[i] - a[i - 1] >= a[i + 1] - a[i] and a[i] - a[0] < a[len(a) - 1] - a[i]:
		print(a[i + 1] - a[i], a[len(a) - 1] - a[i])
	elif a[i] - a[i - 1] < a[i + 1] - a[i] and a[i] - a[0] < a[len(a) - 1] - a[i]:
		print(a[i] - a[i - 1], a[len(a) - 1] - a[i])
print(a[len(a) - 1] - a[len(a) - 2], a[len(a) - 1] - a[0])


n = int(input())
a = [int(num) for num in input().split(' ')]
i = 0
while n - 1 >= i:
	mini = 10000
	max = -10000
	if i == n - 1:
		mini = a[i] - a[i - 1]
		maxi1 = a[i] - a[0]
		maxi2 = a[n - 1] - a[i]
		if maxi1 > maxi2:
			maxi = maxi1
		else:
			maxi = maxi2
	elif i == 0:
		mini = a[i + 1] - a[i]
		maxi1 = a[i] - a[0]
		maxi2 = a[n - 1] - a[i]
		if maxi1 > maxi2:
			maxi = maxi1
		else:
			maxi = maxi2
	else:
		mini1 = a[i + 1] - a[i]
		mini2 = a[i] - a[i - 1]
		maxi1 = a[i] - a[0]
		maxi2 = a[n - 1] - a[i]
		if maxi1 > maxi2:
			maxi = maxi1
		else:
			maxi = maxi2
		if mini1 > mini2:
			mini = mini2
		else:
			mini = mini1
	print('{} {}'.format(mini, maxi))
	i += 1


n = int(input())
cities = list(map(int, input().split(' ')))[:n]
for i in range(0, n):
	Max = 0
	Min = 0
	if i == 0:
		Max = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[n - 1]))
		Min = abs(cities[i] - cities[i + 1])
	elif i == n - 1:
		Max = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[n - 1]))
		Min = abs(cities[i] - cities[i - 1])
	else:
		Max = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[n - 1]))
		Min = min(abs(cities[i] - cities[i - 1]), abs(cities[i] - cities[i + 1]))
	print(Min, Max)


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	(j, k) = (None, None)
	if i > 0:
		j = abs(l[i] - l[i - 1])
	if i < n - 1:
		k = abs(l[i + 1] - l[i])
	if j == None:
		print(k, end=' ')
	elif k == None:
		print(j, end=' ')
	else:
		print(min(j, k), end=' ')
	print(max(l[i] - l[0], l[len(l) - 1] - l[i]))


n = int(input())
s = list(map(int, input().split()))
mi = []
ma = []
mi.append(s[1] - s[0])
ma.append(s[len(s) - 1] - s[0])
for j in range(1, len(s) - 1):
	mi.append(min(s[j + 1] - s[j], s[j] - s[j - 1]))
	ma.append(max(s[j] - s[0], s[len(s) - 1] - s[j]))
mi.append(s[len(s) - 1] - s[len(s) - 2])
ma.append(s[len(s) - 1] - s[0])
for k in range(len(ma)):
	print(mi[k], end=' ')
	print(ma[k])


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


n = int(input())
arr = [int(x) for x in input().split()]
a = arr[0]
z = arr[-1]
print(arr[1] - a, z - a)
for i in range(1, n - 1):
	m = min(arr[i] - arr[i - 1], arr[i + 1] - arr[i])
	M = max(z - arr[i], arr[i] - a)
	print(m, M)
print(z - arr[-2], z - a)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	mn = a[0]
	mx = a[-1]
	print(a[1] - a[0], mx - a[0], sep=' ')
	for i in range(1, n - 1):
		x1 = a[i] - a[i - 1]
		x2 = a[i + 1] - a[i]
		print(min(x1, x2), max(a[i] - mn, mx - a[i]), sep=' ')
	print(a[-1] - a[-2], a[-1] - mn, sep=' ')
	return
main()


import sys
n = int(input())
x = str(input()).split()
print(int(x[1]) - int(x[0]), int(x[n - 1]) - int(x[0]))
for i in range(1, n - 1):
	a1 = int(x[i]) - int(x[i - 1])
	print(min(int(x[i + 1]) - int(x[i]), a1), max(int(x[n - 1]) - int(x[i]), int(x[i]) - int(x[0])))
print(int(x[n - 1]) - int(x[n - 2]), int(x[n - 1]) - int(x[0]))


n = int(input())
ar = [int(i) for i in input().split()]
for i in range(n):
	if i == 0:
		print(ar[i + 1] - ar[i], ar[n - 1] - ar[i])
	elif i == n - 1:
		print(ar[n - 1] - ar[n - 2], ar[n - 1] - ar[0])
	else:
		print(min(ar[i] - ar[i - 1], ar[i + 1] - ar[i]), max(ar[i] - ar[0], ar[n - 1] - ar[i]))


n = int(input())
pos = list(map(int, input().split()))
result = []
for i in range(n):
	if i == 0:
		minx = abs(pos[0] - pos[1])
		maxx = abs(pos[0] - pos[-1])
	elif i == n - 1:
		minx = abs(pos[-1] - pos[-2])
		maxx = abs(pos[-1] - pos[0])
	else:
		minx = min(abs(pos[i] - pos[i + 1]), abs(pos[i] - pos[i - 1]))
		maxx = max(abs(pos[i] - pos[0]), abs(pos[i] - pos[-1]))
	result.append(str(minx) + ' ' + str(maxx))
print('\n'.join(result))


n = int(input())
lis = list(map(int, input().split()))
k = sorted(lis)
for i in range(len(lis)):
	t1 = abs(k[0] - lis[i])
	t2 = abs(k[-1] - lis[i])
	mxdis = max(t1, t2)
	if i == 0:
		mndis = abs(k[0] - k[1])
	elif i == len(lis) - 1:
		mndis = abs(k[len(lis) - 1] - k[len(lis) - 2])
	else:
		mndis = min(abs(k[i] - k[i - 1]), abs(k[i + 1] - k[i]))
	print(mndis, mxdis)


n = int(input())
a = list(map(int, input().split()))
a.sort()
print(str(abs(a[1] - a[0])) + ' ' + str(abs(a[0] - a[n - 1])))
for i in range(1, n - 1):
	if abs(a[i] - a[i + 1]) < abs(a[i] - a[i - 1]):
		x = abs(a[i] - a[i + 1])
	else:
		x = abs(a[i] - a[i - 1])
	if abs(a[i] - a[0]) > abs(a[i] - a[n - 1]):
		z = abs(a[i] - a[0])
	else:
		z = abs(a[i] - a[n - 1])
	print(str(x) + ' ' + str(z))
print(str(abs(a[n - 1] - a[n - 2])) + ' ' + str(abs(a[n - 1] - a[0])))


n = int(input())
inp = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(abs(inp[i] - inp[i + 1]), end=' ')
		print(abs(inp[i] - inp[n - 1]))
	elif i == n - 1:
		print(abs(inp[i] - inp[i - 1]), end=' ')
		print(abs(inp[i] - inp[0]))
	else:
		print(min(abs(inp[i] - inp[i + 1]), abs(inp[i] - inp[i - 1])), end=' ')
		print(max(abs(inp[i] - inp[0]), abs(inp[i] - inp[n - 1])))


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


num_cities = int(input())
x_coordinate = [int(i) for i in input().split()]
for i in range(num_cities):
	if i != 0 and i != num_cities - 1:
		min_dist = min(x_coordinate[i] - x_coordinate[i - 1], x_coordinate[i + 1] - x_coordinate[i])
		max_dist = max(x_coordinate[i] - x_coordinate[0], x_coordinate[-1] - x_coordinate[i])
	elif i == 0:
		min_dist = x_coordinate[1] - x_coordinate[0]
		max_dist = x_coordinate[-1] - x_coordinate[0]
	else:
		min_dist = x_coordinate[-1] - x_coordinate[-2]
		max_dist = x_coordinate[-1] - x_coordinate[0]
	print(min_dist, max_dist)


n = int(input())
A = input()
B = []
C = []
D = []
for i in A.split():
	B.append(int(i))
C.append(abs(B[1] - B[0]))
D.append(abs(B[-1] - B[0]))
for j in range(1, n - 1):
	if abs(B[j + 1] - B[j]) >= abs(B[j] - B[j - 1]):
		C.append(B[j] - B[j - 1])
	else:
		C.append(B[j + 1] - B[j])
	if abs(B[-1] - B[j]) >= abs(B[j] - B[0]):
		D.append(B[-1] - B[j])
	else:
		D.append(B[j] - B[0])
C.append(B[-1] - B[-2])
D.append(B[-1] - B[0])
for k in range(0, n):
	print(str(C[k]) + ' ' + str(D[k]))


n = int(input())
arr = [int(x) for x in input().split()]
arr = sorted(arr)
print(arr[1] - arr[0], arr[n - 1] - arr[0])
for i in range(1, n - 1):
	mn = min(arr[i] - arr[i - 1], arr[i + 1] - arr[i])
	mx = max(arr[i] - arr[0], arr[n - 1] - arr[i])
	print(mn, mx)
print(arr[n - 1] - arr[n - 2], arr[n - 1] - arr[0])


def main():
	n = int(input())
	coords = [int(_) for _ in input().split()]
	copied_coords = coords[:]
	copied_coords.sort()
	min_cost = {}
	max_cost = {}
	for i in range(n):
		min_cost_i = copied_coords[i + 1] - copied_coords[i] if i == 0 else copied_coords[i] - copied_coords[i - 1] if i == n - 1 else min(copied_coords[i] - copied_coords[i - 1], copied_coords[i + 1] - copied_coords[i])
		max_cost_i = copied_coords[n - 1] - copied_coords[0] if i == 0 or i == n - 1 else max(copied_coords[n - 1] - copied_coords[i], copied_coords[i] - copied_coords[0])
		min_cost[copied_coords[i]] = min_cost_i
		max_cost[copied_coords[i]] = max_cost_i
	for i in range(n):
		print('%d %d' % (min_cost[coords[i]], max_cost[coords[i]]))
main()


a = int(input())
lst = [int(x) for x in input().split()]
help_lst = [None] * a
help_lst[0] = (str(lst[1] - lst[0]), str(lst[-1] - lst[0]))
help_lst[-1] = (str(len(range(lst[-2], lst[-1]))), str(len(range(lst[0], lst[-1]))))
for i in range(1, a - 1):
	city_max = max(lst[i] - lst[0], lst[-1] - lst[i])
	city_min = min(lst[i] - lst[i - 1], lst[i + 1] - lst[i])
	help_lst[i] = (str(city_min), str(city_max))
for pair in help_lst:
	print(' '.join(pair))


a = int(input())
s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
sat = []
siro = max(s)
soro = min(s)
print(s[1] - s[0], siro - s[0])
for i in range(1, len(s) - 1):
	mic = min(abs(s[i] - s[i - 1]), abs(s[i] - s[i + 1]))
	mac = max(s[i] - soro, siro - s[i])
	print(mic, mac)
print(siro - s[a - 2], siro - s[0])


n = int(input())
arr = list(map(int, input().split()))
l = 0
r = n - 1
mid = (arr[0] + arr[n - 1]) // 2
print(arr[1] - arr[0], arr[n - 1] - arr[0], sep=' ')
for i in range(1, r):
	print(min(abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1])), max(abs(arr[i] - arr[r]), abs(arr[i] - arr[l])), sep=' ')
print(arr[n - 1] - arr[n - 2], arr[n - 1] - arr[0], sep=' ')


n = int(input())
cities = list(map(int, input().split()))
print(str(abs(cities[0] - cities[1])) + ' ' + str(abs(cities[0] - cities[-1])))
for i in range(1, len(cities) - 1):
	print(str(min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))) + ' ' + str(max(abs(cities[i] - cities[-1]), abs(cities[i] - cities[0]))))
print(str(abs(cities[-1] - cities[-2])) + ' ' + str(abs(cities[-1] - cities[0])))


n = int(input())
line = list(map(int, input().split()))
k1 = max(line)
k2 = min(line)
if n == 2:
	print(k1 - k2, k1 - k2)
	print(k1 - k2, k1 - k2)
else:
	print(line[1] - line[0], k1 - k2)
	for i in range(1, n - 1):
		op1 = min(line[i] - line[i - 1], line[i + 1] - line[i])
		op2 = max(abs(line[i] - k1), abs(line[i] - k2))
		print(op1, op2)
	print(line[-1] - line[-2], k1 - k2)


n = int(input())
cities = [int(x) for x in input().split()]
first = cities[0]
last = cities[n - 1]
print(f'{abs(cities[1] - first)} {abs(last - first)}')
for i in range(1, n - 1):
	c = cities[i]
	d1 = abs(c - cities[i - 1])
	d2 = abs(c - cities[i + 1])
	d3 = abs(c - first)
	d4 = abs(c - last)
	print(f'{min(d1, d2)} {max(d3, d4)}')
print(f'{last - cities[n - 2]} {abs(last - first)}')


n = int(input())
cities = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		mn = abs(cities[i] - cities[i + 1])
		mx = abs(cities[i] - cities[n - 1])
	elif i == n - 1:
		mn = abs(cities[i] - cities[i - 1])
		mx = abs(cities[i] - cities[0])
	else:
		mn = min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))
		mx = max(abs(cities[i] - cities[n - 1]), abs(cities[i] - cities[0]))
	print(mn, mx)


n = int(input())
x = [int(i) for i in input().split()]
for i in range(0, n):
	if i == 0:
		min_d = x[1] - x[0]
		max_d = x[n - 1] - x[0]
	elif i == n - 1:
		min_d = x[n - 1] - x[n - 2]
		max_d = x[n - 1] - x[0]
	else:
		min_d = min(x[i] - x[i - 1], x[i + 1] - x[i])
		max_d = max(x[i] - x[0], x[n - 1] - x[i])
	print(min_d, max_d)


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


n = int(input())
ip = list(map(int, input().split()))
low0 = ip[1] - ip[0]
high0 = ip[n - 1] - ip[0]
print(low0, high0)
for i in range(1, n - 1):
	low = min(ip[i + 1] - ip[i], ip[i] - ip[i - 1])
	high = max(ip[n - 1] - ip[i], ip[i] - ip[0])
	print(low, high)
lown = ip[n - 1] - ip[n - 2]
highn = ip[n - 1] - ip[0]
print(lown, highn)


size = int(input())
arr = input().split(' ')
arr = list(map(int, arr))
print(abs(arr[0] - arr[1]), abs(arr[0] - arr[size - 1]))
for i in range(1, size - 1):
	min_dist = min(abs(arr[i - 1] - arr[i]), abs(arr[i] - arr[i + 1]))
	max_dist = max(abs(arr[0] - arr[i]), abs(arr[i] - arr[size - 1]))
	print(min_dist, max_dist)
print(abs(arr[size - 1] - arr[size - 2]), abs(arr[size - 1] - arr[0]))


import sys
from functools import reduce
lines = iter(sys.stdin.read().split('\n'))
n = int(next(lines))
cities = list(map(int, next(lines).strip(' ').split(' ')))
res = []
for (i, city) in enumerate(cities):
	tmp = []
	if i > 0:
		tmp.append(city - cities[0])
		tmp.append(city - cities[i - 1])
	if i < n - 1:
		tmp.append(cities[-1] - city)
		tmp.append(cities[i + 1] - city)
	res.append('%d %d' % (min(tmp), max(tmp)))
print('\n'.join(res))


n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		h = x[i + 1] - x[i]
		k = x[n - 1] - x[i]
	elif i == n - 1:
		h = x[i] - x[i - 1]
		k = x[i] - x[0]
	else:
		a = x[i + 1] - x[i]
		b = x[i] - x[i - 1]
		h = min(a, b)
		c = x[n - 1] - x[i]
		d = x[i] - x[0]
		k = max(c, d)
	print(h, k)


def main():
	import sys
	(n, *a) = [int(i) for i in sys.stdin.read().split()]
	result = []
	for i in range(n):
		maximal = max(a[i] - a[0], a[n - 1] - a[i])
		if i == 0:
			minimal = a[1] - a[0]
		elif i == n - 1:
			minimal = a[n - 1] - a[n - 2]
		else:
			minimal = min(a[i] - a[i - 1], a[i + 1] - a[i])
		result.append('{0} {1}'.format(minimal, maximal))
	print('\n'.join(result))
main()


n = int(input())
x = list(map(int, input().split()))
minmax = []
for i in range(n):
	if i == 0:
		minmax.append([abs(x[i] - x[i + 1]), abs(x[i] - x[n - 1])])
	elif i == n - 1:
		minmax.append([abs(x[i] - x[i - 1]), abs(x[i] - x[0])])
	else:
		minmax.append([min(abs(x[i] - x[i + 1]), abs(x[i] - x[i - 1])), max(abs(x[i] - x[0]), abs(x[i] - x[n - 1]))])
for i in range(n):
	print(minmax[i][0], minmax[i][1], sep=' ', end='\n')


n = int(input())
line = [int(i) for i in input().split()]
for i in range(n):
	if i == 0:
		a = line[1] - line[0]
		b = line[n - 1] - line[0]
	elif i == n - 1:
		a = line[i] - line[i - 1]
		b = line[i] - line[0]
	else:
		a = min(line[i] - line[i - 1], line[i + 1] - line[i])
		b = max(line[i] - line[0], line[n - 1] - line[i])
	print('{} {}'.format(a, b))


from sys import stdin, stdout
from collections import defaultdict
import heapq as hq

def get_int():
	return int(stdin.readline().strip())

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

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

def get_string():
	return stdin.readline().strip()
INF = 10000000000.0
n = get_int()
x = get_array()
x.sort()
(a, b) = (0, 0)
for i in range(n):
	if i == 0:
		a = abs(x[0] - x[1])
		b = abs(x[0] - x[n - 1])
	if i == n - 1:
		a = abs(x[n - 1] - x[n - 2])
		b = abs(x[0] - x[n - 1])
	else:
		a = min(abs(x[i] - x[i - 1]), abs(x[i] - x[i + 1]))
		b = max(abs(x[i] - x[0]), abs(x[i] - x[n - 1]))
	print(a, b)


n = int(input())
ara = [int(i) for i in input().split()]
mx = None
mn = None
for i in range(n):
	if i == 0:
		mn = int(abs(ara[0] - ara[1]))
		mx = int(abs(ara[0] - ara[n - 1]))
	elif i == n - 1:
		mn = int(abs(ara[i] - ara[i - 1]))
		mx = int(abs(ara[i] - ara[0]))
	else:
		mx = max(int(abs(ara[i] - ara[0])), int(abs(ara[i] - ara[n - 1])))
		mn = min(int(abs(ara[i] - ara[i + 1])), int(abs(ara[i] - ara[i - 1])))
	print(str(mn) + ' ' + str(mx))


n = int(input())
coords = list(map(int, input().split(' ')))
coordsReversed = reversed(coords)
for i in range(n):
	if i == n - 1:
		print(coords[n - 1] - coords[n - 2], coords[n - 1] - coords[0])
	else:
		print(min(abs(coords[i] - coords[i - 1]), abs(coords[i] - coords[i + 1])), max(abs(coords[0] - coords[i]), abs(coords[i] - coords[n - 1])))


n = int(input())
xis = input().strip().split(' ')
xis = [int(x) for x in xis]
for i in range(n):
	if i == 0:
		print(xis[i + 1] - xis[i], end=' ')
	elif i == n - 1:
		print(xis[i] - xis[i - 1], end=' ')
	else:
		print(min(xis[i + 1] - xis[i], xis[i] - xis[i - 1]), end=' ')
	if i == 0:
		print(xis[-1] - xis[i])
	elif i == n - 1:
		print(xis[i] - xis[0])
	else:
		print(max(xis[-1] - xis[i], xis[i] - xis[0]))


n = int(input())
lis = list(map(int, input().strip().split()))
x = {}
minX = 0
for i in range(n):
	if i == 0:
		minX = abs(lis[i] - lis[i + 1])
		maxX = abs(lis[i] - lis[n - 1])
	elif i < n - 1:
		minX = min(abs(lis[i] - lis[i - 1]), abs(lis[i] - lis[i + 1]))
		maxX = max(abs(lis[i] - lis[0]), abs(lis[i] - lis[n - 1]))
	else:
		minX = abs(lis[i] - lis[i - 1])
		maxX = abs(lis[i] - lis[0])
	print(minX, maxX)


import sys
from math import *
input = sys.stdin.buffer.readline
n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(int(fabs(arr[1] - arr[0])), int(fabs(arr[-1] - arr[0])))
	elif i == n - 1:
		print(int(fabs(arr[i] - arr[i - 1])), int(fabs(arr[i] - arr[0])))
	else:
		print(min(int(fabs(arr[i] - arr[i + 1])), int(arr[i] - arr[i - 1])), max(int(fabs(arr[i] - arr[0])), int(fabs(arr[i] - arr[-1]))))


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	m1 = []
	if i > 0:
		m1.append(abs(l[i] - l[i - 1]))
	if i < n - 1:
		m1.append(abs(l[i] - l[i + 1]))
	print(min(m1), max(abs(l[i] - l[0]), abs(l[i] - l[-1])))


n = int(input())
lst = list(map(int, input().split()))
maxi = max(lst[0] - lst[0], lst[n - 1] - lst[0])
mini = lst[1] - lst[0]
print(mini, maxi, end='\n')
for i in range(1, n - 1):
	maxi = max(lst[i] - lst[0], lst[n - 1] - lst[i])
	mini = min(lst[i] - lst[i - 1], lst[i + 1] - lst[i])
	print(mini, maxi, end='\n')
maxi = max(lst[n - 1] - lst[0], lst[n - 1] - lst[n - 1])
mini = lst[n - 1] - lst[n - 2]
print(mini, maxi, end='\n')


n = int(input())
l1 = [int(x) for x in input().split()]
print(abs(l1[1] - l1[0]), abs(l1[-1] - l1[0]))
i = 1
while i < len(l1) - 1:
	print(min(abs(l1[i] - l1[i - 1]), abs(l1[i] - l1[i + 1])), max(abs(l1[i] - l1[0]), abs(l1[i] - l1[-1])))
	i += 1
if len(l1) >= 2:
	print(abs(l1[-1] - l1[-2]), abs(l1[-1] - l1[0]))


n = int(input())
lista = input().split()
min = []
for num in range(len(lista)):
	if num + 1 <= len(lista) - 1:
		if abs(int(lista[num]) - int(lista[num - 1])) < abs(int(lista[num]) - int(lista[num + 1])):
			fim = int(lista[num]) - int(lista[num - 1])
			min.append(fim)
		else:
			fim = abs(int(lista[num]) - int(lista[num + 1]))
			min.append(fim)
	elif abs(int(lista[num]) - int(lista[num - 1])) < abs(int(lista[num]) - int(lista[0])):
		fim = int(lista[num]) - int(lista[num - 1])
		min.append(fim)
	else:
		fim = abs(int(lista[num]) - int(lista[0]))
		min.append(fim)
max = []
for w in range(len(lista)):
	if w == len(lista) - 1:
		s = abs(int(lista[w]) - int(lista[0]))
		max.append(s)
	elif w == 0:
		so = abs(int(lista[-1]) - int(lista[w]))
		max.append(so)
	elif abs(int(lista[w]) - int(lista[0])) > abs(int(lista[w]) - int(lista[-1])):
		som = abs(int(lista[w]) - int(lista[0]))
		max.append(som)
	else:
		soma = abs(int(lista[w]) - int(lista[-1]))
		max.append(soma)
for k in range(len(min)):
	print(min[k], max[k])


n = int(input())
cities = list(map(int, input().split(' ')))
for i in range(len(cities)):
	minimum = 0
	maximum = 0
	if i == 0:
		minimum = cities[1] - cities[0]
		maximum = cities[-1] - cities[0]
	elif i == n - 1:
		minimum = cities[-1] - cities[i - 1]
		maximum = cities[-1] - cities[0]
	else:
		if cities[i] - cities[i - 1] > cities[i + 1] - cities[i]:
			minimum = cities[i + 1] - cities[i]
		else:
			minimum = cities[i] - cities[i - 1]
		if cities[i] - cities[0] > cities[-1] - cities[i]:
			maximum = cities[i] - cities[0]
		else:
			maximum = cities[-1] - cities[i]
	print('%i %i' % (minimum, maximum))


def minimum(distancesList, index):
	if index == 0:
		return abs(int(distancesList[0]) - int(distancesList[1]))
	elif index == distancesList.__len__() - 1:
		x = distancesList.__len__() - 1
		return abs(int(distancesList[x - 1]) - int(distancesList[x]))
	else:
		return min(abs(int(distancesList[index - 1]) - int(distancesList[index])), abs(int(distancesList[index]) - int(distancesList[index + 1])))

def maximum(distancesList, index):
	x = distancesList.__len__() - 1
	if index == 0:
		return abs(int(distancesList[0]) - int(distancesList[x]))
	elif index == x:
		return abs(int(distancesList[0]) - int(distancesList[x]))
	else:
		return max(abs(int(distancesList[index]) - int(distancesList[x])), abs(int(distancesList[0]) - int(distancesList[index])))
n = input()
distances = input().split(' ')
for i in range(int(n)):
	print(minimum(distances, i), maximum(distances, i))


n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
	Max = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	Min = min(abs(a[i] - a[(i + 1) % n]), abs(a[i] - a[i - 1]))
	print(Min, Max)


cidades = int(input())
distancia = list(map(int, input().split()))
cont = 0
for i in range(cidades):
	menor = 0
	maior = 0
	if cont == 0:
		maior = abs(distancia[i] - distancia[cidades - 1])
		menor = abs(distancia[i] - distancia[1])
	elif cont == cidades - 1:
		maior = abs(distancia[i] - distancia[0])
		menor = abs(distancia[i] - distancia[cidades - 2])
	else:
		maior = max(abs(distancia[i] - distancia[0]), abs(distancia[i] - distancia[cidades - 1]))
		menor = min(abs(distancia[i] - distancia[i - 1]), abs(distancia[i] - distancia[i + 1]))
	print('%d %d' % (menor, maior))
	cont += 1


n = int(input())
a = [int(x) for x in input().split()]
for i in range(len(a)):
	if i == 0 or i == len(a) - 1:
		if i == 0:
			print(abs(a[i] - a[i + 1]), abs(a[i] - a[len(a) - 1]))
		else:
			print(abs(a[i] - a[i - 1]), abs(a[i] - a[0]))
	else:
		p = abs(a[i] - a[i - 1])
		q = abs(a[i] - a[i + 1])
		r = abs(a[i] - a[0])
		s = abs(a[i] - a[len(a) - 1])
		print(min(p, q), max(r, s))


import math
from collections import Counter

def sol():
	n = int(input())
	A = [int(i) for i in input().split()]
	for i in range(n):
		if i == 0:
			print(abs(A[i] - A[i + 1]), abs(A[n - 1] - A[0]))
		elif i == n - 1:
			print(abs(A[i] - A[i - 1]), abs(A[n - 1] - A[0]))
		else:
			print(min(abs(A[i] - A[i - 1]), abs(A[i] - A[i + 1])), max(abs(A[i] - A[0]), abs(A[i] - A[n - 1])))
sol()


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


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	max = 0
	min = 10000000000
	if a[i] - a[0] > a[n - 1] - a[i]:
		max = a[i] - a[0]
	else:
		max = a[n - 1] - a[i]
	if i - 1 >= 0:
		if a[i] - a[i - 1] < min:
			min = a[i] - a[i - 1]
	if i + 1 < n:
		if a[i + 1] - a[i] < min:
			min = a[i + 1] - a[i]
	print(str(min) + ' ' + str(max))


def minimumCost(cities):
	distances = []
	for city in range(len(cities)):
		if city == 0:
			minDist = abs(int(cities[city]) - int(cities[city + 1]))
			maxDist = abs(int(cities[len(cities) - 1]) - int(cities[city]))
			distances.append([minDist, maxDist])
			continue
		if city != len(cities) - 1:
			minDist = min(abs(int(cities[city]) - int(cities[city + 1])), abs(int(cities[city]) - int(cities[city - 1])))
			maxDist = max(abs(int(cities[city]) - int(cities[0])), abs(int(cities[city]) - int(cities[len(cities) - 1])))
			distances.append([minDist, maxDist])
			continue
		else:
			minDist = abs(int(cities[city]) - int(cities[city - 1]))
			maxDist = abs(int(cities[city]) - int(cities[0]))
			distances.append([minDist, maxDist])
	return distances
num = input()
listOfInputs = input().split()
distances = minimumCost(listOfInputs)
for i in range(int(num)):
	print(str(distances[i][0]) + ' ' + str(distances[i][1]))


import itertools as itls

def inputarray(func=int):
	return map(func, input().split())

def diff(v, x=0):
	v = iter(v)
	while True:
		try:
			y = next(v)
			yield (y - x)
			x = y
		except StopIteration:
			return
inf = float('inf')
N = int(input())
A = list(inputarray(float))
MIN = map(lambda x: min(abs(x[0]), abs(x[1])), zip(diff(A, -inf), reversed(list(diff(reversed(A), -inf)))))
MAX = map(lambda x: max(abs(x - A[0]), abs(x - A[-1])), A)
for ij in zip(map(int, MIN), map(int, MAX)):
	print('%d %d' % ij)


no = input()
Ct = input()
city = Ct.split(' ')
noC = int(no)
cities = []
for i in city:
	cities.append(int(i))
print(str(abs(cities[0] - cities[1])) + ' ' + str(abs(cities[0] - cities[noC - 1])))
for i in range(1, noC - 1):
	minN = abs(cities[i] - cities[i + 1])
	if abs(cities[i] - cities[i - 1]) < minN:
		minN = abs(cities[i] - cities[i - 1])
	maxN = abs(cities[i] - cities[noC - 1])
	if abs(cities[i] - cities[0]) > maxN:
		maxN = abs(cities[i] - cities[0])
	print(str(minN) + ' ' + str(maxN))
print(str(abs(cities[noC - 1] - cities[noC - 2])) + ' ' + str(abs(cities[noC - 1] - cities[0])))


qtdcity = int(input())
c = [int(i) for i in input().split()]
mod = min(c)
mod = abs(mod)
for i in range(len(c)):
	mini = 10000000000
	maxi = 0
	if i != 0:
		res = abs(c[i] + mod - (c[i - 1] + mod))
		if mini > res:
			mini = res
	else:
		res = abs(c[i] + mod - (c[len(c) - 1] + mod))
		if maxi < res:
			maxi = res
	if i != len(c) - 1:
		res = abs(c[i] + mod - (c[i + 1] + mod))
		if mini > res:
			mini = res
	else:
		res = abs(c[0] + mod - (c[i] + mod))
		if maxi < res:
			maxi = res
	if i != 0 and i != len(c) - 1:
		resl = abs(c[0] + mod - (c[i] + mod))
		resr = abs(c[i] + mod - (c[len(c) - 1] + mod))
		maxi = max(resl, resr)
	print(str(mini) + ' ' + str(maxi))


N = int(input())
xs = [int(x) for x in input().split(' ')]
leftmost = xs[0]
rightmost = xs[-1]
for i in range(0, len(xs)):
	if i == 0:
		leftDist = 2000000000
	else:
		leftDist = abs(xs[i - 1] - xs[i])
	if i == len(xs) - 1:
		rightDist = 2000000000
	else:
		rightDist = abs(xs[i + 1] - xs[i])
	leftmostDist = abs(leftmost - xs[i])
	rightmostDist = abs(rightmost - xs[i])
	print('%d %d' % (min(leftDist, rightDist), max(leftmostDist, rightmostDist)))


n = int(input())
a = [int(s) for s in input().split()]
for (i, x) in enumerate(a):
	max_d = max(x - a[0], a[-1] - x)
	if 0 < i < len(a) - 1:
		min_d = min(x - a[i - 1], a[i + 1] - x)
	elif i == 0:
		min_d = a[1] - x
	elif i == len(a) - 1:
		min_d = x - a[-2]
	print(min_d, max_d)


def minn(cities):
	min_ = int(cities[0])
	if min_ < 0:
		for i in range(len(cities)):
			cities[i] = int(cities[i]) + min_ * -1
n = int(input())
cities = input().split()
minn(cities)
for i in range(len(cities)):
	if i == 0:
		min_ = int(cities[i + 1]) - int(cities[i])
	elif i == len(cities) - 1:
		min_ = int(cities[i]) - int(cities[i - 1])
	else:
		min_ = min(int(cities[i]) - int(cities[i - 1]), int(cities[i + 1]) - int(cities[i]))
	max_ = max(int(cities[len(cities) - 1]) - int(cities[i]), int(cities[i]) - int(cities[0]))
	print(str(min_) + ' ' + str(max_))


def dist(a, b):
	if a < 0 and b < 0:
		return abs(abs(a) - abs(b))
	elif a < 0 and b >= 0:
		return abs(a) + b
	elif a >= 0 and b < 0:
		return a + abs(b)
	else:
		return abs(a - b)
n = int(input())
li = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		(minima, maxima) = (dist(li[i], li[i + 1]), dist(li[i], li[-1]))
	elif i == n - 1:
		(minima, maxima) = (dist(li[i - 1], li[i]), dist(li[0], li[i]))
	else:
		(minima, maxima) = (min(dist(li[i - 1], li[i]), dist(li[i], li[i + 1])), max(dist(li[i], li[-1]), dist(li[0], li[i])))
	print(minima, maxima)


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	maximum = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	if i == 0:
		minimum = abs(a[i] - a[i + 1])
	elif i == n - 1:
		minimum = abs(a[i] - a[i - 1])
	else:
		minimum = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
	print(minimum, maximum)


nct = int(input())
cities = list(map(int, input().split()))
for i in range(nct):
	if cities == 0:
		left_min = left_max = abs(cities[i] - cities[-1])
	else:
		left_min = abs(cities[i] - cities[i - 1])
		left_max = abs(cities[i] - cities[0])
	if i == nct - 1:
		right_min = right_max = abs(cities[0] - cities[i])
	else:
		right_min = abs(cities[i + 1] - cities[i])
		right_max = abs(cities[-1] - cities[i])
	mn = min(left_min, right_min)
	mx = max(left_max, right_max)
	print(mn, mx)


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


n = int(input())
l = list(map(int, input().split()))
print(str(l[1] - l[0]) + ' ' + str(l[-1] - l[0]))
for i in range(1, n - 1):
	my_min = min(l[i] - l[i - 1], l[i + 1] - l[i])
	my_max = max(l[-1] - l[i], l[i] - l[0])
	print(str(my_min) + ' ' + str(my_max))
print(str(l[-1] - l[n - 2]) + ' ' + str(l[-1] - l[0]))


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


num = int(input())
cities = [int(i) for i in input().split()]

def length(x1, x2):
	return abs(x1 - x2)
for (index, city) in enumerate(cities):
	if index == 0:
		print(f'{length(city, cities[1])} {length(city, cities[num - 1])}')
	elif index == num - 1:
		print(f'{length(city, cities[index - 1])} {length(city, cities[0])}', end='')
	else:
		minBetween = min(length(city, cities[index - 1]), length(city, cities[index + 1]))
		minEnd = max(length(city, cities[0]), length(city, cities[num - 1]))
		print(f'{min(minBetween, minEnd)} {max(minBetween, minEnd)}')


n = int(input())
c = [int(z) for z in input().split()]
print(c[1] - c[0], c[-1] - c[0], end='\n')
for i in range(1, n - 1):
	print(min(c[i] - c[i - 1], c[1 + i] - c[i]), max(c[i] - c[0], c[-1] - c[i]), end='\n')
print(c[-1] - c[-2], c[-1] - c[0], end='\n')


input()
X = list(map(int, input().split()))
for i in range(len(X)):
	if i == 0:
		print(abs(X[1] - X[0]), abs(X[-1] - X[0]))
		continue
	elif i == len(X) - 1:
		print(abs(X[-2] - X[-1]), abs(X[0] - X[-1]))
		continue
	print(min(abs(X[i] - X[i - 1]), abs(X[i] - X[i + 1])), max(abs(X[i] - X[-1]), abs(X[i] - X[0])))


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


t = int(input())
a = list(map(int, input().split()))
for i in range(t):
	ma = max(abs(a[0] - a[i]), abs(a[i] - a[t - 1]))
	if i == 0:
		mi = abs(a[0] - a[1])
	if i == t - 1:
		mi = abs(a[t - 1] - a[t - 2])
	else:
		mi = min(abs(a[i] - a[i + 1]), abs(a[i] - a[i - 1]))
	print(mi, ma)


n = int(input())
coordenadas = list(map(int, input().split(' ')))
minimos = []
maximos = []
for x in range(0, n):
	if x == 0:
		minimos.append(abs(coordenadas[x] - coordenadas[x + 1]))
	elif x == n - 1:
		minimos.append(abs(coordenadas[x] - coordenadas[x - 1]))
	else:
		minimos.append(min(abs(coordenadas[x] - coordenadas[x - 1]), abs(coordenadas[x] - coordenadas[x + 1])))
	maximos.append(max(abs(coordenadas[x] - coordenadas[len(coordenadas) - 1]), coordenadas[x] - coordenadas[0]))
for x in range(0, len(maximos)):
	print(str(minimos[x]) + ' ' + str(maximos[x]))


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(abs(a[i] - a[i + 1]), abs(a[i] - a[-1]))
	elif i == n - 1:
		print(abs(a[i] - a[i - 1]), abs(a[i] - a[0]))
	else:
		m = min(abs(a[i] - a[i + 1]), abs(a[i] - a[i - 1]))
		h = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
		print(m, h)


class Solution:

	def __init__(self):
		self.n = int(input())
		self.x = [int(xi) for xi in input().split()]

	def solve_and_print(self):
		print(f'{self.x[1] - self.x[0]} {self.x[-1] - self.x[0]}')
		for i in range(1, self.n - 1):
			print(f'{min(self.x[i + 1] - self.x[i], self.x[i] - self.x[i - 1])} {max(self.x[-1] - self.x[i], self.x[i] - self.x[0])}')
		print(f'{self.x[-1] - self.x[-2]} {self.x[-1] - self.x[0]}')
Solution().solve_and_print()


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	n = inin()
	a = ain()
	for i in range(n):
		if i == 0:
			print(a[i + 1] - a[i], a[n - 1] - a[i])
		elif i == n - 1:
			print(a[i] - a[i - 1], a[i] - a[0])
		else:
			print(min(a[i + 1] - a[i], a[i] - a[i - 1]), max(a[n - 1] - a[i], a[i] - a[0]))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
main()


n_cities = int(input())
cities = list(map(int, input().split()))
print(abs(cities[1] - cities[0]), abs(cities[n_cities - 1] - cities[0]))
for i in range(1, n_cities - 1):
	nearest = min(abs(cities[i] - cities[i - 1]), abs(cities[i + 1] - cities[i]))
	farthest = max(abs(cities[i] - cities[0]), abs(cities[n_cities - 1] - cities[i]))
	print(nearest, farthest)
print(abs(cities[n_cities - 1] - cities[n_cities - 2]), abs(cities[n_cities - 1] - cities[0]))


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

def main():
	n = int(input())
	A = list(map(int, input().split()))
	for i in range(n):
		minv = []
		if i - 1 >= 0:
			minv.append(abs(A[i] - A[i - 1]))
		if i + 1 < n:
			minv.append(abs(A[i] - A[i + 1]))
		maxv = []
		maxv.append(abs(A[i] - A[0]))
		maxv.append(abs(A[i] - A[n - 1]))
		min_val = min(minv)
		max_val = max(maxv)
		print('%d %d' % (min_val, max_val))
main()


n = int(input())
q = [int(x) for x in input().split()]
q.sort()
for (idx, elmt) in enumerate(q):
	tmin1 = tmin2 = int(3000000000.0)
	if idx - 1 >= 0:
		tmin1 = abs(elmt - q[idx - 1])
	if idx + 1 < n:
		tmin2 = abs(elmt - q[idx + 1])
	vmin = min(tmin1, tmin2)
	vmax = max(abs(elmt - q[0]), abs(elmt - q[-1]))
	print(vmin, vmax)


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


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

def dist(a, b):
	if a - b < 0:
		return -(a - b)
	else:
		return a - b

def minMaxDist(index, pos):
	if index == 0:
		minn = dist(pos[index], pos[index + 1])
	elif index == n - 1:
		minn = dist(pos[index - 1], pos[index])
	else:
		minn = min(dist(pos[index], pos[index + 1]), dist(pos[index], pos[index - 1]))
	if index == 0 or index == n - 1:
		maxx = dist(pos[0], pos[n - 1])
	else:
		maxx = max(dist(pos[index], pos[0]), dist(pos[index], pos[n - 1]))
	return (minn, maxx)
for i in range(n):
	(minn, maxx) = minMaxDist(i, pos)
	print(minn, maxx)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
ara = inara()
for i in range(n):
	if i == 0:
		mini = abs(ara[i + 1] - ara[i])
		maxi = abs(ara[-1] - ara[i])
		print(str(mini) + ' ' + str(maxi))
	elif i == n - 1:
		mini = abs(ara[i] - ara[i - 1])
		maxi = abs(ara[i] - ara[0])
		print(str(mini) + ' ' + str(maxi))
	else:
		mini = min(abs(ara[i + 1] - ara[i]), abs(ara[i] - ara[i - 1]))
		maxi = max(abs(ara[i] - ara[0]), abs(ara[-1] - ara[i]))
		print(str(mini) + ' ' + str(maxi))


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


n = int(input().strip())
ll = list(map(int, input().split()))
ll = ll
for i in range(n):
	if 0 < i < n - 1:
		print(min(ll[i + 1] - ll[i], ll[i] - ll[i - 1]), max(ll[i] - ll[0], ll[-1] - ll[i]))
	elif i == 0:
		print(ll[i + 1] - ll[i], ll[-1] - ll[0])
	else:
		print(ll[i] - ll[i - 1], ll[i] - ll[0])


(n, cities, ans) = (int(input().strip()), list(map(int, input().split())), [])
cities.sort()
for i in range(n):
	if i == n - 1:
		maxi = cities[i] - cities[0]
	elif i == 0:
		maxi = cities[-1] - cities[i]
	else:
		maxi = max(cities[-1] - cities[i], cities[i] - cities[0])
	if i == n - 1:
		mini = cities[i] - cities[i - 1]
	elif i == 0:
		mini = cities[i + 1] - cities[i]
	else:
		mini = min(cities[i + 1] - cities[i], cities[i] - cities[i - 1])
	ans.append([mini, maxi])
for row in ans:
	print(*row)


n = int(input())
cities = list(map(int, input().split()))
for (i, c) in enumerate(cities):
	if i == 0:
		print('%s %s' % (cities[1] - c, cities[n - 1] - c))
	elif i == n - 1:
		print('%s %s' % (c - cities[n - 2], c - cities[0]))
	else:
		print('%s %s' % (min(c - cities[i - 1], cities[i + 1] - c), max(cities[n - 1] - c, c - cities[0])))


N = int(input())
List = [int(x) for x in input().split()]
print(abs(List[0] - List[1]), abs(List[0] - List[-1]))
for i in range(1, N - 1):
	Min = min(abs(List[i] - List[i - 1]), abs(List[i] - List[i + 1]))
	Max = max(abs(List[i] - List[0]), abs(List[i] - List[-1]))
	print(Min, Max)
print(abs(List[N - 1] - List[N - 2]), abs(List[N - 1] - List[0]))


n = int(input())
l = input().split()
for i in range(n):
	l[i] = int(l[i])
x = l[n - 1] - l[0]
for i in range(n):
	r = l[i] - l[0]
	if r >= x - r:
		if i == 0:
			print(l[i + 1] - l[i], '', end='')
		elif i == n - 1:
			print(l[i] - l[i - 1], '', end='')
		elif l[i] - l[i - 1] > l[i + 1] - l[i]:
			print(l[i + 1] - l[i], '', end='')
		else:
			print(l[i] - l[i - 1], '', end='')
		print(r)
	else:
		if i == 0:
			print(l[i + 1] - l[i], '', end='')
		elif i == n - 1:
			print(l[i] - l[i - 1], '', end='')
		elif l[i] - l[i - 1] > l[i + 1] - l[i]:
			print(l[i + 1] - l[i], '', end='')
		else:
			print(l[i] - l[i - 1], '', end='')
		print(x - r)


n = int(input())
x = input().split()
x = list(map(int, x))
for i in range(n):
	if i == 0:
		mi = abs(x[i + 1] - x[i])
	elif i == n - 1:
		mi = abs(x[i] - x[i - 1])
	else:
		mi1 = abs(x[i + 1] - x[i])
		mi2 = abs(x[i - 1] - x[i])
		mi = min(mi1, mi2)
	ma1 = abs(x[i] - x[0])
	ma2 = abs(x[n - 1] - x[i])
	ma = max(ma1, ma2)
	print(mi, ma)


def funcao(a, b, c):
	return min(b - a, c - b)

def funcao2(a, b, c):
	return max(b - a, c - b)
n = int(input())
lista = input().split()
lista = list(map(int, lista))
tam = len(lista)
fim = lista[tam - 1]
ini = lista[0]
res = []
i = 0
while i < tam:
	if i == 0:
		res.append(lista[1] - lista[0])
	elif i == tam - 1:
		res.append(lista[tam - 1] - lista[tam - 2])
	else:
		res.append(funcao(lista[i - 1], lista[i], lista[i + 1]))
	res.append(funcao2(ini, lista[i], fim))
	i += 1
j = 0
while j < len(res):
	print(res[j], res[j + 1])
	j += 2


def main():
	n = int(input())
	data = [int(v) for v in input().split()]
	vals = list(data)
	vals.sort()
	res = {}
	for i in range(n):
		if i == 0:
			min_v = abs(vals[i] - vals[i + 1])
			max_v = abs(vals[i] - vals[-1])
		elif i == n - 1:
			min_v = abs(vals[i] - vals[i - 1])
			max_v = abs(vals[i] - vals[0])
		else:
			min_v = min(abs(vals[i] - vals[i - 1]), abs(vals[i] - vals[i + 1]))
			max_v = max(abs(vals[i] - vals[0]), abs(vals[i] - vals[-1]))
		res[vals[i]] = (min_v, max_v)
	for d in data:
		print(res[d][0], res[d][1])
main()


n = int(input())
l = list(map(int, input().split()))
i = 0
while i < n:
	mx = -1
	mi = 10000000000
	if i + 1 != n:
		mx = max(mx, abs(l[i] - l[i + 1]))
		mx = max(mx, abs(l[i] - l[n - 1]))
		mi = min(mi, abs(l[i] - l[i + 1]))
	if i != 0:
		mx = max(mx, abs(l[i] - l[0]))
		mi = min(mi, abs(l[i] - l[0]))
		mi = min(mi, abs(l[i] - l[i - 1]))
	print(mi, mx)
	i += 1


n = int(input())
nums = list(map(lambda x: int(x), input().split()))
nums.sort()
if n < 2 or len(nums) < 2:
	exit(0)
m = nums[1] - nums[0]
M = nums[-1] - nums[0]
print(str(m) + ' ' + str(M))
for i in range(1, len(nums) - 1):
	m = nums[i + 1] - nums[i]
	m2 = nums[i] - nums[i - 1]
	M = nums[-1] - nums[i]
	M2 = nums[i] - nums[0]
	if m > m2:
		m = m2
	if M < M2:
		M = M2
	print(str(m) + ' ' + str(M))
m = nums[-1] - nums[-2]
M = nums[-1] - nums[0]
print(str(m) + ' ' + str(M))


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


inf = 10 ** 10
n = int(input())
a = [-inf] + list(map(int, input().split())) + [inf]
(Lmax, Rmax) = (0, a[n] - a[1])
(Lmin, Rmin) = (a[1] - a[0], a[2] - a[1])
for i in range(1, n + 1):
	Lmin = Rmin
	Rmin = a[i + 1] - a[i]
	Min = min(Lmin, Rmin)
	Max = max(Lmax, Rmax)
	print(Min, Max)
	Lmax += a[i + 1] - a[i]
	Rmax -= a[i + 1] - a[i]


n = int(input())
s = list(map(int, input().split()))
print(abs(s[0] - s[1]), abs(s[0] - s[n - 1]))
mn = abs(s[0] - s[n - 1])
mx = 0
for i in range(1, n - 1):
	if abs(s[i] - s[i - 1]) < abs(s[i] - s[i + 1]):
		mn = abs(s[i] - s[i - 1])
	else:
		mn = abs(s[i] - s[i + 1])
	if abs(s[i] - s[0]) > abs(s[i] - s[n - 1]):
		mx = abs(s[i] - s[0])
	else:
		mx = abs(s[i] - s[n - 1])
	print(mn, mx)
	mn = abs(s[0] - s[n - 1])
	mx = 0
print(abs(s[n - 1] - s[n - 2]), abs(s[n - 1] - s[0]))


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		minDist = abs(a[i] - a[i + 1])
		maxDist = a[n - 1] - a[i]
	elif i > 0 and i < n - 1:
		if abs(a[i] - a[i - 1]) < abs(a[i] - a[i + 1]):
			minDist = abs(a[i] - a[i - 1])
		else:
			minDist = abs(a[i] - a[i + 1])
		if abs(a[i] - a[0]) > abs(a[i] - a[n - 1]):
			maxDist = abs(a[i] - a[0])
		else:
			maxDist = abs(a[i] - a[n - 1])
	else:
		minDist = abs(a[i] - a[i - 1])
		maxDist = a[i] - a[0]
	print('%d %d' % (minDist, maxDist))


n = int(input())
ls = list(map(int, input().split()))
for i in range(0, n):
	mn = 10000000000.0 + 100000.0
	mx = -10000000000.0
	if i == 0:
		mn = abs(ls[i + 1] - ls[i])
		mx = abs(ls[n - 1] - ls[i])
	elif i == n - 1:
		mn = abs(ls[i - 1] - ls[i])
		mx = abs(ls[0] - ls[i])
	else:
		mn = min(abs(ls[i - 1] - ls[i]), abs(ls[i + 1] - ls[i]))
		mx = max(abs(ls[0] - ls[i]), abs(ls[n - 1] - ls[i]))
	print(mn, mx)


n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
	print(min(a[i] - a[i - 1] if i else float('inf'), a[i + 1] - a[i] if i < n - 1 else float('inf')), max(abs(a[i] - a[0]), abs(a[i] - a[n - 1])))


length = int(input())
x = list(map(int, input().split(' ')))
for i in range(length):
	t = x[i]
	print(min(abs(t - x[i - 1]), abs(x[i - length + 1] - t)), max(t - x[0], x[length - 1] - t))


n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(n):
	maxi = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	if i == 0:
		mini = abs(a[i] - a[i + 1])
	elif i == n - 1:
		mini = abs(a[i] - a[i - 1])
	else:
		mini = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
	l.append([mini, maxi])
for row in l:
	print(*row)


in1 = int(input())
in2 = list(map(int, input().rstrip().split()))
for i in range(len(in2)):
	if i == 0:
		mini = abs(in2[i + 1] - in2[i])
		maxi = abs(in2[len(in2) - 1] - in2[i])
		print(mini, maxi)
	elif i == len(in2) - 1:
		mini = abs(in2[i - 1] - in2[i])
		maxi = abs(in2[0] - in2[i])
		print(mini, maxi)
	else:
		mini = min(abs(in2[i - 1] - in2[i]), abs(in2[i + 1] - in2[i]))
		maxi = max(abs(in2[len(in2) - 1] - in2[i]), abs(in2[0] - in2[i]))
		print(mini, maxi)


def calcCityDs(cities):
	for i in range(len(cities)):
		if i == 0:
			print(distance(cities[i], cities[i + 1]), distance(cities[i], cities[len(cities) - 1]))
		elif i == len(cities) - 1:
			print(distance(cities[i], cities[i - 1]), distance(cities[i], cities[0]))
		else:
			minD1 = distance(cities[i], cities[i - 1])
			minD2 = distance(cities[i], cities[i + 1])
			maxD1 = distance(cities[i], cities[0])
			maxD2 = distance(cities[i], cities[len(cities) - 1])
			minD = minD1 if minD1 < minD2 else minD2
			maxD = maxD1 if maxD1 > maxD2 else maxD2
			print(minD, maxD)

def distance(x1, x2):
	return abs(x2 - x1)
n = input()
cities = list(map(int, input().split()))
calcCityDs(cities)


def min_distance(i, l):
	if i == len(l) - 1:
		return abs(l[i] - l[i - 1])
	return min(abs(l[i] - l[i + 1]), abs(l[i] - l[i - 1]))

def max_distance(i, l):
	return max(abs(l[i] - l[0]), abs(l[i] - l[-1]))
n = int(input())
l = list(map(int, input().split()))
for i in range(len(l)):
	print(min_distance(i, l), max_distance(i, l))


x = int(input())
nums = list(map(int, input().split()))
a = []
for i in range(0, x):
	mx = max(abs(nums[i] - nums[0]), abs(nums[i] - nums[x - 1]))
	if i == 0:
		mn = abs(nums[i] - nums[i + 1])
	elif i == x - 1:
		mn = abs(nums[i] - nums[i - 1])
	else:
		mn = min(abs(nums[i] - nums[i - 1]), abs(nums[i] - nums[i + 1]))
	a.append([mn, mx])
for row in a:
	print(*row)


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


n1 = input()
n = int(n1)
st = list(input().split(' '))
for i in range(n):
	if i == 0:
		print(abs(int(st[1]) - int(st[0])), abs(int(st[n - 1]) - int(st[0])))
	elif i == n - 1:
		print(abs(int(st[n - 1]) - int(st[n - 2])), abs(int(st[n - 1]) - int(st[0])))
	else:
		print(min(abs(int(st[i]) - int(st[i - 1])), abs(int(st[i + 1]) - int(st[i]))), max(abs(int(st[n - 1]) - int(st[i])), abs(int(st[i]) - int(st[0]))))


n = int(input())
cities = list(map(int, input().split()))
ans = {}
for (i, c) in enumerate(cities):
	l = abs(cities[i - 1] - c) if i > 0 else 2 * 10 ** 9
	r = abs(cities[i + 1] - c) if i < len(cities) - 1 else 2 * 10 ** 9
	min_d = min(l, r)
	l = abs(cities[0] - c) if i != 0 else 0
	r = abs(cities[len(cities) - 1] - c) if i != len(cities) - 1 else 0
	max_d = max(l, r)
	print(min_d, max_d)


n = int(input())
p = list(map(int, input().split()))
for i in range(n):
	if p[i] is p[0]:
		print(abs(p[0] - p[1]), abs(p[0] - p[-1]))
	elif p[i] is p[-1]:
		print(abs(p[-1] - p[-2]), abs(p[-1] - p[0]))
	else:
		print(min(abs(p[i] - p[i + 1]), abs(p[i] - p[i - 1])), max(abs(p[i] - p[0]), abs(p[i] - p[-1])))


number_of_cities = int(input())
postion_of_cities = list(map(int, input().split()))
sorted_cities = sorted(postion_of_cities)
costs = list()
i = 0
while i < len(sorted_cities):
	if sorted_cities[i] == sorted_cities[0]:
		minmum = abs(sorted_cities[1] - sorted_cities[i])
		maxmum = abs(sorted_cities[-1] - sorted_cities[i])
		costs.append(minmum)
		costs.append(maxmum)
	elif sorted_cities[i] == sorted_cities[-1]:
		minmum = abs(sorted_cities[-2] - sorted_cities[i])
		maxmum = abs(sorted_cities[0] - sorted_cities[i])
		costs.append(minmum)
		costs.append(maxmum)
	elif sorted_cities[i] == sorted_cities[1]:
		minmum1 = abs(sorted_cities[0] - sorted_cities[i])
		minmum2 = abs(sorted_cities[2] - sorted_cities[i])
		minmum3 = abs(sorted_cities[-1] - sorted_cities[i])
		minmum = [minmum1, minmum2, minmum3]
		m = min(minmum)
		costs.append(m)
		maxmum1 = abs(sorted_cities[0] - sorted_cities[i])
		maxmum2 = abs(sorted_cities[2] - sorted_cities[i])
		maxmum3 = abs(sorted_cities[-1] - sorted_cities[i])
		maxmum = [maxmum1, maxmum2, maxmum3]
		mx = max(maxmum)
		costs.append(mx)
	elif sorted_cities[i] == sorted_cities[-2]:
		minmum1 = abs(sorted_cities[-1] - sorted_cities[i])
		minmum2 = abs(sorted_cities[-3] - sorted_cities[i])
		minmum3 = abs(sorted_cities[0] - sorted_cities[i])
		minmum = [minmum1, minmum2, minmum3]
		m = min(minmum)
		costs.append(m)
		maxmum1 = abs(sorted_cities[-1] - sorted_cities[i])
		maxmum2 = abs(sorted_cities[-3] - sorted_cities[i])
		maxmum3 = abs(sorted_cities[0] - sorted_cities[i])
		maxmum = [maxmum1, maxmum2, maxmum3]
		mx = max(maxmum)
		costs.append(mx)
	else:
		minmum1 = abs(sorted_cities[0] - sorted_cities[i])
		minmum2 = abs(sorted_cities[i - 1] - sorted_cities[i])
		minmum3 = abs(sorted_cities[i + 1] - sorted_cities[i])
		minmum4 = abs(sorted_cities[i - 1] - sorted_cities[i])
		minmum = [minmum1, minmum2, minmum3, minmum4]
		m = min(minmum)
		costs.append(m)
		maxmum1 = abs(sorted_cities[0] - sorted_cities[i])
		maxmum2 = abs(sorted_cities[-1] - sorted_cities[i])
		maxmum3 = abs(sorted_cities[i + 1] - sorted_cities[i])
		maxmum4 = abs(sorted_cities[i - 1] - sorted_cities[i])
		maxmum = [maxmum1, maxmum2, maxmum3, maxmum4]
		mx = max(maxmum)
		costs.append(mx)
	i += 1
cost = 0
while cost < len(costs) - 1:
	print(costs[cost], costs[cost + 1])
	cost += 2


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


import sys
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
for (i, j) in enumerate(arr):
	if i == 0:
		print(arr[i + 1] - j, arr[-1] - j)
	elif i == n - 1:
		print(arr[-1] - arr[-2], arr[-1] - arr[0])
	else:
		print(min(j - arr[i - 1], arr[i + 1] - j), max(j - arr[0], arr[-1] - j))


def sol(n, arr):
	arr.sort()
	print(str(arr[1] - arr[0]) + ' ' + str(arr[-1] - arr[0]))
	for i in range(1, n - 1):
		print(str(min(arr[i] - arr[i - 1], arr[i + 1] - arr[i])) + ' ' + str(max(arr[i] - arr[0], arr[-1] - arr[i])))
	print(str(arr[-1] - arr[-2]) + ' ' + str(arr[-1] - arr[0]))
	return
n = int(input())
arr = list(map(int, input().split()))
sol(n, arr)


n = int(input())
l1 = list(map(int, input().split()))
l2 = l1.copy()
l2.sort()
for i in range(n):
	max1 = max(l1[n - 1] - l1[i], l1[i] - l1[0])
	if i == 0:
		min1 = l1[1] - l1[0]
	elif i == n - 1:
		min1 = l1[n - 1] - l1[n - 2]
	else:
		min1 = min(l1[i] - l1[i - 1], l1[i + 1] - l1[i])
	print(min1, max1)


n = int(input())
loc = [int(x) for x in input().split()]
for i in range(n):
	if i == 0:
		print(loc[1] - loc[i], loc[-1] - loc[i])
	elif i == n - 1:
		print(loc[i] - loc[-2], loc[i] - loc[0])
	else:
		mini = min(abs(loc[i] - loc[i + 1]), abs(loc[i] - loc[i - 1]))
		maxi = max(abs(loc[i] - loc[0]), abs(loc[i] - loc[-1]))
		print(mini, maxi)


num_cities = int(input())
cities = list(map(int, input().split()))
results = list()
for i in range(num_cities):
	maximum = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[-1]))
	if i == 0:
		minimum = abs(cities[i] - cities[i + 1])
	elif i == num_cities - 1:
		minimum = abs(cities[i] - cities[i - 1])
	else:
		minimum = min(abs(cities[i] - cities[i - 1]), abs(cities[i] - cities[i + 1]))
	results.append([minimum, maximum])
for result in results:
	print(*result)


rows = int(input())
cities = input().split()
l_edge = int(cities[0])
r_edge = int(cities[-1])
firstCity = (abs(int(cities[1]) - l_edge), abs(r_edge - l_edge))
lastCity = (abs(r_edge - int(cities[-2])), abs(r_edge - l_edge))
for i in range(len(cities)):
	if i == 0:
		print(*firstCity)
		continue
	elif i == len(cities) - 1:
		print(*lastCity)
		continue
	city = int(cities[i])
	l_neighboor = int(cities[i - 1])
	r_neighboor = int(cities[i + 1])
	minDist = min(abs(city - l_neighboor), abs(city - r_neighboor))
	maxDist = max(abs(city - l_edge), abs(city - r_edge))
	print(minDist, maxDist)


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


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	maxx = 0
	minn = 0
	if i != 0 and i != n - 1:
		peeche = abs(l[i] - l[i - 1])
		aage = abs(l[i] - l[i + 1])
		peeche1 = abs(l[i] - l[0])
		aage1 = abs(l[i] - l[-1])
		minn = min(peeche, aage)
		maxx = max(peeche1, aage1)
	if i == 0:
		minn = abs(l[0] - l[1])
		maxx = abs(l[0] - l[-1])
	elif i == n - 1:
		minn = abs(l[i] - l[i - 1])
		maxx = abs(l[i] - l[0])
	print(minn, maxx)


n = int(input())
num = [int(i) for i in input().split()]
respm = []
respM = []
respm.append(num[1] - num[0])
respM.append(num[-1] - num[0])
for i in range(1, n - 1):
	respm.append(min(num[i] - num[i - 1], num[i + 1] - num[i]))
	respM.append(max(num[i] - num[0], num[-1] - num[i]))
respm.append(num[-1] - num[-2])
respM.append(num[-1] - num[0])
for i in range(n):
	print(respm[i], respM[i])


n = int(input())
miasta = list(map(int, input().split(' ')))
miasta.insert(0, float('-inf'))
miasta.append(float('inf'))
for i in range(1, n + 1):
	minimum = min(miasta[i] - miasta[i - 1], miasta[i + 1] - miasta[i])
	maximum = max(miasta[i] - miasta[1], miasta[n] - miasta[i])
	print(minimum, maximum)


cidades = int(input())
distancias = [int(x) for x in input().split()]
distancias.sort()
maior = 0
menor = 0
for i in range(len(distancias)):
	tmp = distancias[i]
	lista = []
	if i == 0:
		lista.append(distancias[i + 1] - tmp)
		lista.append(distancias[len(distancias) - 1] - tmp)
	elif i == len(distancias) - 1:
		lista.append(tmp - distancias[i - 1])
		lista.append(tmp - distancias[0])
	else:
		lista.append(distancias[i + 1] - tmp)
		lista.append(tmp - distancias[i - 1])
		lista.append(tmp - distancias[0])
		lista.append(distancias[len(distancias) - 1] - tmp)
	print('%d %d' % (min(lista), max(lista)))


input()
lis = list(map(int, input().split()))
(start, stop) = (lis[0], lis[len(lis) - 1])
print(abs(start - lis[1]), abs(start - stop))
for i in range(1, len(lis) - 1):
	print(min(abs(lis[i] - lis[i - 1]), abs(lis[i] - lis[i + 1])), max(abs(lis[i] - start), abs(lis[i] - stop)))
print(abs(stop - lis[len(lis) - 2]), abs(start - stop))


n = int(input())
l = input().split()
for i in range(n):
	if i == 0:
		p = int(l[i + 1]) - int(l[i])
	elif i == n - 1:
		p = int(l[i]) - int(l[i - 1])
	else:
		p = int(l[i]) - int(l[i - 1])
		pp = int(l[i + 1]) - int(l[i])
		p = min(pp, p)
	q = int(l[i]) - int(l[-1])
	r = int(l[i]) - int(l[0])
	if q < 0:
		q = q * -1
	if r < 0:
		r = r * -1
	if q < r:
		q = r
	print(p, q)


n = int(input())
num = input()
a = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr = get_the_data(0, num, a)
for i in range(0, len(arr)):
	if i == 0:
		max = arr[len(arr) - 1] - arr[i]
		min = arr[i + 1] - arr[i]
		print(str(min) + ' ' + str(max))
	elif i == len(arr) - 1:
		max = arr[i] - arr[0]
		min = arr[i] - arr[i - 1]
		print(str(min) + ' ' + str(max))
	else:
		min = None
		if arr[i] - arr[i - 1] < arr[i + 1] - arr[i]:
			min = arr[i] - arr[i - 1]
		else:
			min = arr[i + 1] - arr[i]
		max = None
		if arr[i] - arr[0] > arr[len(arr) - 1] - arr[i]:
			max = arr[i] - arr[0]
		else:
			max = arr[len(arr) - 1] - arr[i]
		print(str(min) + ' ' + str(max))


n = int(input())
l = list(map(int, input().split()))
for i in range(len(l)):
	maximum = max(abs(l[0] - l[i]), abs(l[-1] - l[i]))
	if i - 1 >= 0 and i + 1 < len(l):
		minimum = min(abs(l[i - 1] - l[i]), abs(l[i] - l[i + 1]))
	elif i - 1 < 0:
		minimum = abs(l[i] - l[i + 1])
	else:
		minimum = abs(l[i - 1] - l[i])
	print(minimum, maximum)


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	mini = 0
	maxi = 0
	if i > 0 and i >= n - 1:
		mini = abs(a[i] - a[i - 1])
		maxi = abs(a[i] - a[0])
	elif i < n - 1 and i <= 0:
		mini = abs(a[i] - a[i + 1])
		maxi = abs(a[i] - a[-1])
	else:
		mini = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		maxi = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(mini, maxi)


n = int(input())
ls = [int(i) for i in input().split()]
print(abs(ls[1] - ls[0]), abs(ls[len(ls) - 1] - ls[0]))
for i in range(1, n - 1):
	mini = min(abs(ls[i] - ls[i - 1]), abs(ls[i] - ls[i + 1]))
	maxi = max(abs(ls[i] - ls[0]), abs(ls[i] - ls[n - 1]))
	print(mini, maxi)
	i += 1
print(abs(ls[n - 1] - ls[n - 2]), abs(ls[n - 1] - ls[0]))


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


import sys
n = int(input())
pos = list(map(int, sys.stdin.readline().split()))
for i in range(n):
	if i == 0:
		mmin = pos[1] - pos[0]
		mmax = pos[n - 1] - pos[0]
	elif i == n - 1:
		mmin = pos[n - 1] - pos[n - 2]
		mmax = abs(pos[n - 1] - pos[0])
	else:
		mmin = min(pos[i] - pos[i - 1], pos[i + 1] - pos[i])
		mmax = max(pos[i] - pos[0], pos[n - 1] - pos[i])
	print(mmin, mmax, sep=' ')


x = input()
x = list(map(int, input().strip().split()))
for i in range(len(x)):
	minimum = x[len(x) - 1]
	maximum = x[0]
	if i > 0 and i < len(x) - 1:
		if abs(x[i] - x[i + 1]) > abs(x[i - 1] - x[i]):
			minimum = abs(x[i - 1] - x[i])
		else:
			minimum = abs(x[i] - x[i + 1])
		if abs(x[i] - x[0]) > abs(x[i] - x[len(x) - 1]):
			maximum = abs(x[i] - x[0])
		else:
			maximum = abs(x[i] - x[len(x) - 1])
	elif i == 0:
		minimum = abs(x[i] - x[i + 1])
		maximum = abs(x[i] - x[len(x) - 1])
	else:
		minimum = abs(x[i - 1] - x[i])
		maximum = abs(x[i] - x[0])
	print('%d %d' % (minimum, maximum))


n = int(input())
x = input()
x = x.split()
res = list()
be = 0
af = 0
beg = 0
end = 0
for i in range(n):
	x[i] = int(x[i])
for i in range(n):
	if i == 0:
		if x[i] <= 0 and x[i + 1] <= 0:
			t = -1 * x[i]
			z = t + x[i + 1]
			res.append(abs(z))
		elif x[i] < 0 and x[i + 1] > 0:
			z = abs(x[i] - x[i + 1])
			res.append(abs(z))
		else:
			z = x[i + 1] - x[i]
			res.append(abs(z))
		if x[i] <= 0 and x[n - 1] <= 0:
			t = x[i] * -1
			z = t + x[n - 1]
			res.append(abs(z))
		elif x[i] < 0 and x[n - 1] > 0:
			z = x[i] - x[n - 1]
			res.append(abs(z))
		else:
			z = x[i] - x[n - 1]
			res.append(abs(z))
	elif i == n - 1:
		if x[i] <= 0 and x[i - 1] <= 0:
			t = x[i] * -1
			z = t + x[i - 1]
			res.append(abs(z))
		elif x[i] < 0 and x[i - 1] > 0:
			z = abs(x[i] - x[i - 1])
			res.append(abs(z))
		else:
			z = x[i - 1] - x[i]
			res.append(abs(z))
		if x[i] <= 0 and x[0] <= 0:
			t = x[i] * -1
			z = t + x[0]
			res.append(abs(z))
		elif x[i] < 0 and x[0] > 0:
			z = abs(x[i] - x[0])
			res.append(abs(z))
		else:
			z = x[i] - x[0]
			res.append(abs(z))
	else:
		if x[i] <= 0 and x[i + 1] <= 0:
			t = x[i] * -1
			z = t + x[i + 1]
			be = abs(z)
		elif x[i] < 0 and x[i + 1] > 0:
			z = x[i] - x[i + 1]
			be = abs(z)
		else:
			z = x[i + 1] - x[i]
			be = abs(z)
		if x[i] <= 0 and x[i - 1] <= 0:
			t = x[i] * -1
			z = t + x[i - 1]
			af = abs(z)
		elif x[i] < 0 and x[i - 1] > 0:
			z = abs(x[i] - x[i - 1])
			af = abs(z)
		else:
			z = x[i - 1] - x[i]
			af = abs(z)
		if be <= af:
			res.append(be)
		else:
			res.append(af)
		if x[i] <= 0 and x[n - 1] <= 0:
			t = x[i] * -1
			z = t + x[n - 1]
			end = abs(z)
		elif x[i] < 0 and x[n - 1] > 0:
			z = abs(x[i] - x[n - 1])
			end = abs(z)
		else:
			z = x[i] - x[n - 1]
			end = abs(z)
		if x[i] <= 0 and x[0] <= 0:
			t = x[i] * -1
			z = t + x[0]
			beg = abs(z)
		elif x[i] < 0 and x[0] > 0:
			z = abs(x[i] - x[0])
			beg = abs(z)
		else:
			z = x[i] - x[0]
			beg = abs(z)
		if end > beg:
			res.append(end)
		else:
			res.append(beg)
for i in range(0, len(res), 2):
	print(res[i], res[i + 1])


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	m = 10 ** 10
	if i != 0:
		m = a[i] - a[i - 1]
	if i + 1 != n:
		m = min(m, a[i + 1] - a[i])
	print(m, max(a[i] - a[0], a[-1] - a[i]))


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
n = ini()
a = inl()
a = list(map(lambda x: x - a[0], a))
for i in range(n):
	if i == 0:
		print(a[1], a[n - 1])
	elif i == n - 1:
		print(a[n - 1] - a[n - 2], a[n - 1])
	else:
		print(min(a[i] - a[i - 1], a[i + 1] - a[i]), max(a[i] - a[0], a[n - 1] - a[i]))


n = int(input())
position = [int(x) for x in input().split()]
mincost = [position[1] - position[0], position[-1] - position[-2]]
maxcost = [position[-1] - position[0], position[-1] - position[0]]
for i in range(1, n - 1):
	mincost.insert(-1, min(position[i] - position[i - 1], position[i + 1] - position[i]))
	maxcost.insert(-1, max(position[i] - position[0], position[-1] - position[i]))
for i in range(n):
	print('%d %d' % (mincost[i], maxcost[i]))


n = int(input())
cities = [int(x) for x in input().split(' ')]
left = cities[0]
right = cities[-1]
for i in range(n):
	menor = 20000000000
	atual = cities[i]
	if i < n - 1:
		menor = abs(atual - cities[i + 1])
	if i > 0:
		menor = min(menor, abs(atual - cities[i - 1]))
	maior = max(abs(atual - left), abs(atual - right))
	print(menor, maior)


n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		minimum = x[1] - x[0]
		maximum = x[-1] - x[0]
	elif i == n - 1:
		minimum = x[-1] - x[-2]
		maximum = x[-1] - x[0]
	else:
		left_min = x[i] - x[i - 1]
		right_min = x[i + 1] - x[i]
		minimum = min(left_min, right_min)
		left_max = x[i] - x[0]
		right_max = x[-1] - x[i]
		maximum = max(right_max, left_max)
	print(minimum, maximum)


def l_mail(l):
	n = len(l)
	(westest, eastest) = (l[0], l[n - 1])
	r = list()
	for i in range(n):
		if i == 0:
			r.append([l[1] - westest, eastest - westest])
		elif i == n - 1:
			r.append([eastest - l[n - 2], eastest - westest])
		else:
			r.append([min(l[i] - l[i - 1], l[i + 1] - l[i]), max(eastest - l[i], l[i] - westest)])
	return r
n = int(input().strip())
l = list(map(int, input().strip().split()))
assert len(l) == n
r = l_mail(l)
for i in range(n):
	print(*r[i])


from sys import stdin, stdout
n = int(input())
a = list(map(int, stdin.readline().split()))
(mn, mx) = (0, 0)
for i in range(n):
	if i == 0:
		mn = abs(a[1] - a[0])
		mx = abs(a[i] - a[-1])
	elif i == n - 1:
		mn = abs(a[i] - a[-2])
		mx = abs(a[i] - a[0])
	else:
		mn = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		mx = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(mn, mx)


n = int(input())
c = list(map(int, input().split()))
c.sort()
for i in range(n):
	minD = 0
	maxD = 0
	if i == 0:
		minD = abs(c[i] - c[i + 1])
		maxD = abs(c[i] - c[n - 1])
	elif i == n - 1:
		minD = abs(c[i] - c[i - 1])
		maxD = abs(c[i] - c[0])
	else:
		minLeft = abs(c[i] - c[i - 1])
		minRight = abs(c[i] - c[i + 1])
		minD = abs(min(minLeft, minRight))
		maxLeft = abs(c[i] - c[0])
		maxRight = abs(c[i] - c[n - 1])
		maxD = max(maxLeft, maxRight)
	print(minD, end=' ')
	print(maxD)


e = int(input())
c = list(map(int, input().split()))
m = []
for i in range(e):
	mm = max(abs(c[i] - c[0]), abs(c[i] - c[-1]))
	if i == 0:
		mi = abs(c[i] - c[i + 1])
	elif i == e - 1:
		mi = abs(c[i] - c[i - 1])
	else:
		mi = min(abs(c[i] - c[i - 1]), abs(c[i] - c[i + 1]))
	m.append([mi, mm])
for row in m:
	print(*row)


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


import math
n = int(input())
x = list(map(int, input().split()))
min_n = 0
max_n = 0
print(x[1] - x[0], x[len(x) - 1] - x[0])
for i in range(n - 2):
	if abs(x[i + 1] - x[i]) < abs(x[i + 1] - x[i + 2]):
		min_n = abs(x[i + 1] - x[i])
	else:
		min_n = abs(x[i + 1] - x[i + 2])
	if abs(x[i + 1] - x[0]) > abs(x[i + 1] - x[len(x) - 1]):
		max_n = abs(x[i + 1] - x[0])
	else:
		max_n = abs(x[i + 1] - x[len(x) - 1])
	print(min_n, max_n)
print(x[len(x) - 1] - x[len(x) - 2], x[len(x) - 1] - x[0])


import math
n = int(input())
l = [int(x) for x in input().split()]
for i in range(n):
	mini = math.inf
	maxi = 0
	if i == 0:
		mini = abs(l[i] - l[i + 1])
		maxi = abs(l[i] - l[-1])
	elif i == n - 1:
		mini = abs(l[i] - l[i - 1])
		maxi = abs(l[i] - l[0])
	else:
		mini = min(abs(l[i] - l[i - 1]), abs(l[i] - l[i + 1]))
		maxi = max(abs(l[i] - l[0]), abs(l[i] - l[-1]))
	print(mini, maxi)


cidades = int(input())
distancias = list(map(int, input().split(' ')))
for i in range(cidades):
	if i == 0:
		minimo = abs(distancias[i] - distancias[i + 1])
		maximo = abs(distancias[i] - distancias[-1])
	elif i == cidades - 1:
		minimo = abs(distancias[i] - distancias[i - 1])
		maximo = abs(distancias[0] - distancias[i])
	else:
		minimo = min(abs(distancias[i] - distancias[i + 1]), abs(distancias[i - 1] - distancias[i]))
		maximo = max(abs(distancias[i] - distancias[-1]), abs(distancias[0] - distancias[i]))
	print('{0} {1}'.format(minimo, maximo))


N = int(input())
Xs = list(map(int, input().split()))
for (i, x) in enumerate(Xs):
	if i == 0:
		print(Xs[1] - x, Xs[-1] - x)
		continue
	if i == N - 1:
		print(x - Xs[N - 2], x - Xs[0])
		continue
	mincost = min(Xs[i + 1] - x, x - Xs[i - 1])
	maxcost = max(Xs[-1] - x, x - Xs[0])
	print(mincost, maxcost)


trash = int(input())
positions = [int(n) for n in input().split()]
for i in range(0, len(positions)):
	if i == 0:
		print(positions[1] - positions[0], positions[-1] - positions[0])
	elif i == len(positions) - 1:
		print(positions[i] - positions[i - 1], positions[i] - positions[0])
	else:
		print(min(positions[i] - positions[i - 1], positions[i + 1] - positions[i]), max(positions[i] - positions[0], positions[-1] - positions[i]))


def getMax(a, b):
	return abs(a - b)

def getMin(a, b):
	return abs(a - b)
n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	(Min, Max) = (0, 0)
	if i == 0:
		Min = getMin(arr[i], arr[i + 1])
		Max = getMax(arr[i], arr[n - 1])
	elif i == n - 1:
		Min = getMin(arr[i], arr[i - 1])
		Max = getMax(arr[i], arr[0])
	else:
		Min = min(getMin(arr[i], arr[i - 1]), getMin(arr[i], arr[i + 1]))
		Max = max(getMax(arr[i], arr[n - 1]), getMax(arr[i], arr[0]))
	print(Min, Max)


n = int(input())
lst = [int(i) for i in input().split()]
j = 1
print(lst[1] - lst[0], lst[-1] - lst[0])
for i in range(1, n - 1):
	print(min(lst[j + 1] - lst[j], lst[j] - lst[j - 1]), end=' ')
	print(max(lst[-1] - lst[j], lst[j] - lst[0]))
	j += 1
print(lst[-1] - lst[-2], lst[-1] - lst[0])


cities = int(input())
coord = [int(i) for i in input().split()]
for i in range(cities):
	minl = min(abs(coord[i] - coord[i - 1]), abs(coord[i] - coord[(i + 1) % cities]))
	maxl = max(abs(coord[i] - coord[0]), abs(coord[i] - coord[cities - 1]))
	print(minl, maxl)


tam = input()
tam = int(tam)
elems = [int(x) for x in input().split(' ')]
print(elems[1] - elems[0], elems[tam - 1] - elems[0])
for i in range(1, len(elems) - 1):
	print(min(elems[i] - elems[i - 1], elems[i + 1] - elems[i]), max(elems[i] - elems[0], elems[tam - 1] - elems[i]))
print(elems[tam - 1] - elems[tam - 2], elems[tam - 1] - elems[0])


n = int(input())
x = [int(a) for a in input().split()]
dist = []
print(abs(x[0] - x[1]), abs(x[0] - x[n - 1]))
for i in range(1, n - 1):
	Min = abs(x[i] - x[i - 1]) if abs(x[i] - x[i - 1]) < abs(x[i] - x[i + 1]) else abs(x[i] - x[i + 1])
	Max = abs(x[i] - x[0]) if abs(x[i] - x[0]) > abs(x[i] - x[n - 1]) else abs(x[i] - x[n - 1])
	print(Min, Max)
print(abs(x[n - 1] - x[n - 2]), abs(x[n - 1] - x[0]))


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if i == 0:
		p = abs(a[i] - a[i + 1])
		q = abs(a[i] - a[n - 1])
	elif i == n - 1:
		p = abs(a[i] - a[i - 1])
		q = abs(a[i] - a[0])
	else:
		p = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		q = max(abs(a[i] - a[0]), abs(a[i] - a[n - 1]))
	print(p, q)


num_cities = int(input())
c = list(map(int, input().split()))
print(abs(c[0] - c[1]), abs(c[0] - c[-1]))
for i in range(1, len(c) - 1):
	med = min(abs(c[i] - c[i - 1]), abs(c[i] - c[i + 1]))
	mad = max(abs(c[i] - c[0]), abs(c[i] - c[-1]))
	print(med, mad)
print(abs(c[-1] - c[-2]), abs(c[-1] - c[0]))


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	otv = []
	if i == 0:
		otv.append(abs(a[i] - a[i + 1]))
		otv.append(abs(a[i] - a[-1]))
	elif i == n - 1:
		otv.append(abs(a[i] - a[i - 1]))
		otv.append(abs(a[i] - a[0]))
	else:
		otv.append(min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1])))
		otv.append(max(abs(a[i] - a[-1]), abs(a[i] - a[0])))
	print(' '.join((str(x) for x in otv)))


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


from operator import itemgetter
n = int(input())
x = sorted(enumerate(map(int, input().split())), key=itemgetter(1))
d = lambda a, b: x[b][1] - x[a][1]
p = lambda a, b: ' '.join(map(str, (a, b)))
print('\n'.join((p(d(0, 1), d(i, -1)) if i == 0 else p(d(-2, -1), d(0, -1)) if i == n - 1 else p(min(d(i - 1, i), d(i, i + 1)), max(d(0, i), d(i, -1))) for i in range(n))))


n = int(input())
cities = [int(i) for i in input().split()]
for i in range(n):
	if i == 0:
		min = cities[1] - cities[0]
		max = cities[n - 1] - cities[0]
	elif i == n - 1:
		min = cities[n - 1] - cities[n - 2]
		max = cities[n - 1] - cities[0]
	else:
		calc1 = cities[i] - cities[i - 1]
		calc2 = cities[i + 1] - cities[i]
		if calc1 > calc2:
			min = calc2
		else:
			min = calc1
		calc1 = cities[i] - cities[0]
		calc2 = cities[n - 1] - cities[i]
		if calc1 < calc2:
			max = calc2
		else:
			max = calc1
	print('{} {}'.format(min, max, i))


n = int(input())
s = []
x = input()
xx = x.split()
for i in range(0, n):
	xx[i] = int(xx[i])
if n > 2:
	p = [xx[1] - xx[0], xx[n - 1] - xx[0]]
	s.append(p)
	for i in range(1, n - 1):
		p = []
		if xx[i] - xx[i - 1] <= xx[i + 1] - xx[i]:
			p.append(xx[i] - xx[i - 1])
		else:
			p.append(xx[i + 1] - xx[i])
		if xx[n - 1] - xx[i] >= xx[i] - xx[0]:
			p.append(xx[n - 1] - xx[i])
		else:
			p.append(xx[i] - xx[0])
		s.append(p)
	p = [xx[n - 1] - xx[n - 2], xx[n - 1] - xx[0]]
	s.append(p)
	for i in s:
		print(i[0], end=' ')
		print(i[1])
else:
	print(xx[1] - xx[0], end=' ')
	print(xx[1] - xx[0])
	print(xx[1] - xx[0], end=' ')
	print(xx[1] - xx[0])


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


import sys
numberOfCities = int(input())
xCoordinates = input().split(' ')
xCoordinates = list(map(int, xCoordinates))
print(xCoordinates[1] - xCoordinates[0], xCoordinates[-1] - xCoordinates[0])
for i in range(1, len(xCoordinates) - 1):
	print(min(xCoordinates[i] - xCoordinates[i - 1], xCoordinates[i + 1] - xCoordinates[i]), max(xCoordinates[i] - xCoordinates[0], xCoordinates[-1] - xCoordinates[i]))
print(xCoordinates[-1] - xCoordinates[-2], xCoordinates[-1] - xCoordinates[0])


no_cities = int(input())
string = input()
l1 = string.split(' ')
l2 = []
count = 0
for ele in l1:
	ele = int(ele)
	l2.append(ele)
l4 = l2[:]
l4.sort(reverse=True)
for ele in l2:
	left = l2[0]
	right = l4[0]
	dist1 = ele - left
	dist2 = right - ele
	if dist1 == 0:
		mincost = l2[1] - ele
		maxcost = l4[0] - ele
		print(mincost, maxcost)
	elif dist2 == 0:
		mincost = l4[0] - l4[1]
		maxcost = ele - l2[0]
		print(mincost, maxcost)
	elif dist1 > dist2:
		dista = ele - l2[count - 1]
		distb = l2[count + 1] - ele
		if dista > distb:
			mincost = distb
		else:
			mincost = dista
		maxcost = dist1
		print(mincost, maxcost)
	elif dist2 > dist1:
		maxcost = dist2
		dista = ele - l2[count - 1]
		distb = l2[count + 1] - ele
		if dista > distb:
			mincost = distb
		else:
			mincost = dista
		print(mincost, maxcost)
	elif dist1 == dist2:
		maxcost = dist1
		dista = ele - l2[count - 1]
		distb = l2[count + 1] - ele
		if dista > distb:
			mincost = distb
		else:
			mincost = dista
		print(mincost, maxcost)
	count = count + 1


n = int(input())
arr = list(map(int, input().split()))
li = []
for i in range(n):
	if i == 0:
		mi = abs(arr[0] - arr[1])
		ma = abs(arr[0] - arr[-1])
	elif i == n - 1:
		mi = abs(arr[n - 1] - arr[n - 2])
		ma = abs(arr[n - 1] - arr[0])
	else:
		mi = abs(min(abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1])))
		ma = abs(max(abs(arr[i] - arr[0]), abs(arr[i] - arr[n - 1])))
	j = [mi, ma]
	j.sort()
	li.append(j)
for i in li:
	print(*i)


n = int(input())
a = list(map(int, input().split()))
(min1, max1) = (0, 0)
for i in range(0, n - 1):
	if i == 0:
		min1 = abs(a[0] - a[1])
		max1 = abs(a[0] - a[n - 1])
	else:
		min1 = min(abs(a[i] - a[i + 1]), abs(a[i - 1] - a[i]))
	if a[i] * a[n - 1] < 0:
		max1 = max((a[n - 1] - a[i], a[i] - a[0]))
	else:
		max1 = max(abs(a[i] - a[n - 1]), abs(a[0] - a[i]))
	print(min1, max1)
print(abs(a[n - 2] - a[n - 1]), abs(a[0] - a[n - 1]))


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


import math

def maxi(coord, e):
	j = len(coord) - 1
	if abs(coord[j] - coord[e]) >= abs(coord[e] - coord[0]):
		maxi = abs(coord[j] - coord[e])
	else:
		maxi = abs(coord[e] - coord[0])
	return abs(maxi)

def mini(coord, e):
	if e > 0 and e != len(coord) - 1:
		if abs(coord[e] - coord[e - 1]) <= abs(coord[e] - coord[e + 1]):
			mini = coord[e] - coord[e - 1]
		else:
			mini = coord[e] - coord[e + 1]
	elif e == 0:
		mini = coord[e] - coord[e + 1]
	else:
		mini = coord[e] - coord[e - 1]
	return abs(mini)
n = int(input())
coord = list(map(int, input().split(' ')))
for e in range(n):
	print(mini(coord, e), end=' ')
	print(maxi(coord, e))


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

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

def stringlis():
	return list(map(str, inp().split()))

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

def strsep():
	return map(str, inp().split())

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

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solve(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solve(p * 10 + a, l + 1, a, b, n)
	solve(p * 10 + b, l + 1, a, b, n)

def main():
	n = inpu()
	x = lis()
	l = []
	l.append([abs(x[0] - x[1]), abs(x[n - 1] - x[0])])
	for i in range(1, n - 1):
		l.append([min(abs(x[i] - x[i - 1]), abs(x[i] - x[i + 1])), max(abs(x[i] - x[0]), abs(x[i] - x[n - 1]))])
	l.append([abs(x[n - 1] - x[n - 2]), abs(x[n - 1] - x[0])])
	for i in l:
		print(*i)
main()


n = int(input())
cities = list(map(int, input().split()))
print(cities[1] - cities[0], cities[-1] - cities[0])
mini = 0
maxi = 0
for i in range(1, n - 1):
	if abs(cities[i - 1] - cities[i]) < abs(cities[i + 1] - cities[i]):
		mini = abs(cities[i - 1] - cities[i])
	else:
		mini = abs(cities[i + 1] - cities[i])
	if abs(cities[0] - cities[i]) > abs(cities[-1] - cities[i]):
		maxi = abs(cities[0] - cities[i])
	else:
		maxi = abs(cities[-1] - cities[i])
	print(mini, maxi)
print(abs(cities[-2] - cities[-1]), abs(cities[0] - cities[-1]))


n = int(input())
s = [int(a) for a in input().split()]
i = 0
while i < len(s):
	if i == 0:
		print('{} {}'.format(abs(s[1] - s[0]), abs(s[-1] - s[0])))
	elif i == len(s) - 1:
		print('{} {}'.format(abs(s[-2] - s[-1]), abs(s[-1] - s[0])))
	else:
		mi = min(abs(s[i + 1] - s[i]), abs(s[i - 1] - s[i]))
		ma = max(abs(s[-1] - s[i]), abs(s[0] - s[i]))
		print('{} {}'.format(mi, ma))
	i = i + 1


def distance(a, b):
	if a < 0 and b > 0:
		return b - a
	else:
		return abs(a - b)
n = int(input())
cities = list(map(int, input().split()))
for i in range(len(cities)):
	if i == 0:
		mini = abs(cities[i + 1] - cities[i])
		maxi = abs(cities[-1] - cities[i])
	elif i == len(cities) - 1:
		mini = abs(cities[i] - cities[i - 1])
		maxi = abs(cities[i] - cities[0])
	else:
		mini = min(abs(cities[i + 1] - cities[i]), abs(cities[i] - cities[i - 1]))
		maxi = max(abs(cities[-1] - cities[i]), abs(cities[0] - cities[i]))
	print(str(mini) + ' ' + str(maxi))


banyak = int(input())
lokasi = input().split()
for i in range(0, banyak):
	if i == 0:
		kecil = abs(int(lokasi[0]) - int(lokasi[1]))
		besar = int(lokasi[-1]) - int(lokasi[0])
	elif i == banyak - 1:
		kecil = int(lokasi[-1]) - int(lokasi[-2])
		besar = int(lokasi[-1]) - int(lokasi[0])
	else:
		kecil = min(int(lokasi[i]) - int(lokasi[i - 1]), int(lokasi[i + 1]) - int(lokasi[i]))
		besar = max(int(lokasi[-1]) - int(lokasi[i]), int(lokasi[i]) - int(lokasi[0]))
	print(kecil, end=' ')
	print(besar)


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


__author__ = 'artyom'

def main():
	n = read()
	a = read(3)
	(f, l) = (a[0], a[-1])
	print(a[1] - f, l - f)
	for i in range(1, n - 1):
		print(min(a[i] - a[i - 1], a[i + 1] - a[i]), max(a[i] - f, l - a[i]))
	print(l - a[-2], l - f)

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a
main()


def mail(n, lst):
	b = list()
	for i in range(n):
		if i == 0:
			b.append([lst[1] - lst[0], lst[n - 1] - lst[0]])
		elif i == n - 1:
			b.append([lst[n - 1] - lst[n - 2], lst[n - 1] - lst[0]])
		else:
			b.append([min(lst[i + 1] - lst[i], lst[i] - lst[i - 1]), max(lst[i] - lst[0], lst[n - 1] - lst[i])])
	return b
m = int(input())
a = [int(j) for j in input().split()]
for elem in mail(m, a):
	print(*elem)


n = int(input())
xs = input()
x = [int(el) for el in xs.split()]
for i in range(0, n):
	if i == 0:
		mini = x[1] - x[0]
	elif i == n - 1:
		mini = x[i] - x[i - 1]
	else:
		mini = min(x[i] - x[i - 1], x[i + 1] - x[i])
	maxi = max(x[i] - x[0], x[n - 1] - x[i])
	print(mini, maxi)


n = int(input())
l = list(map(int, input().split()))
ans = []
for i in range(n):
	m = []
	if i == 0:
		m.append(abs(l[i] - l[i + 1]))
		m.append(abs(l[i] - l[n - 1]))
	elif i == n - 1:
		m.append(abs(l[i] - l[i - 1]))
		m.append(abs(l[i] - l[0]))
	else:
		m.append(min(abs(l[i] - l[i + 1]), abs(l[i] - l[i - 1])))
		m.append(max(abs(l[i] - l[0]), abs(l[i] - l[n - 1])))
	ans.append(m)
for i in ans:
	print(' '.join((str(x) for x in i)))


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


n = int(input())
s = str(input()).split()
for i in range(n):
	s[i] = int(s[i])
for i in range(n):
	if i == 0:
		print('{} {}'.format(s[1] - s[0], s[n - 1] - s[0]))
	elif i == n - 1:
		print('{} {}'.format(s[n - 1] - s[n - 2], s[n - 1] - s[0]))
	else:
		if s[i] - s[i - 1] < s[i + 1] - s[i]:
			m1 = s[i] - s[i - 1]
		else:
			m1 = s[i + 1] - s[i]
		if s[n - 1] - s[i] > s[i] - s[0]:
			m2 = s[n - 1] - s[i]
		else:
			m2 = s[i] - s[0]
		print('{} {}'.format(m1, m2))


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


import math

def distance(a, b):
	return math.sqrt((a - b) ** 2)

def solution(n, x):
	for i in range(n):
		if i == 0:
			yield (distance(x[i], x[i + 1]), distance(x[i], x[-1]))
		elif i == n - 1:
			yield (distance(x[i], x[i - 1]), distance(x[i], x[0]))
		else:
			d1 = distance(x[i], x[i - 1])
			d2 = distance(x[i], x[i + 1])
			dmin = d1 if d1 <= d2 else d2
			d1 = distance(x[i], x[0])
			d2 = distance(x[i], x[-1])
			dmax = d1 if d1 >= d2 else d2
			yield (dmin, dmax)
n = int(input())
x = list(map(int, input().split()))
for result in solution(n, x):
	print('%i %i' % result)


x = int(input())
l = list(map(int, input().split()))
print(l[1] - l[0], l[x - 1] - l[0])
for i in range(1, len(l) - 1):
	if l[i] - l[i - 1] > l[i + 1] - l[i]:
		t = l[i + 1] - l[i]
	else:
		t = l[i] - l[i - 1]
	if l[i] - l[0] > l[x - 1] - l[i]:
		t1 = l[i] - l[0]
	else:
		t1 = l[x - 1] - l[i]
	print(t, t1)
print(l[x - 1] - l[x - 2], l[x - 1] - l[0])


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


n = int(input())
towns = list(map(int, input().split()))
i = 0
while i != n:
	max_distance = max(towns[i] - towns[0], towns[n - 1] - towns[i])
	if i <= n - 2 and i >= 1:
		min_distance = min(towns[i + 1] - towns[i], towns[i] - towns[i - 1])
	elif i == 0:
		min_distance = towns[1] - towns[0]
	elif i == n - 1:
		min_distance = towns[n - 1] - towns[n - 2]
	print(min_distance, end=' ')
	print(max_distance)
	i += 1


n = int(input())
l = [int(i) for i in input().split()]
m = []
large = []
s = 0
for i in range(n):
	maximum = 0
	if i == 0 or i == n - 1:
		if l[0] * l[-1] < 0:
			s = abs(l[0]) + abs(l[-1])
			if s > maximum:
				maximum = s
		else:
			s = abs(abs(l[0]) - abs(l[-1]))
			if s > maximum:
				maximum = s
	elif l[0] * l[i] < 0:
		s = max(abs(abs(l[0]) + abs(l[i])), abs(abs(l[i]) - abs(l[-1])))
		if s > maximum:
			maximum = s
	elif l[i] <= 0 and l[-1] >= 0:
		s = max(abs(abs(l[0]) - abs(l[i])), abs(abs(l[i]) + abs(l[-1])))
		if s > maximum:
			maximum = s
	elif l[-1] < 0 or l[0] >= 0:
		s = max(abs(abs(l[0]) - abs(l[i])), abs(abs(l[i]) - abs(l[-1])))
		if s > maximum:
			maximum = s
	large.append(maximum)
for i in range(n):
	minimum = 9999999999
	if i == 0:
		s = abs(l[i + 1] - l[i])
		if s < minimum:
			minimum = s
	elif i == n - 1:
		s = abs(l[i] - l[i - 1])
		if s < minimum:
			minimum = s
	elif l[i - 1] >= 0 or l[i + 1] < 0:
		s = min(abs(abs(l[i - 1]) - abs(l[i])), abs(abs(l[i + 1]) - abs(l[i])))
		if s < minimum:
			minimum = s
	elif l[i - 1] < 0 and l[i] >= 0:
		s = min(abs(abs(l[i - 1]) + abs(l[i])), abs(abs(l[i + 1]) - abs(l[i])))
		if s < minimum:
			minimum = s
	elif l[i] < 0:
		s = min(abs(abs(l[i - 1]) - abs(l[i])), abs(abs(l[i + 1]) + abs(l[i])))
		if s < minimum:
			minimum = s
	m.append(minimum)
for i in range(n):
	print(m[i], large[i])


x = input()
l = list(map(int, input().split()))
res = []
for i in range(len(l)):
	if i == 0:
		mi = abs(l[0] - l[1])
		ma = abs(l[0] - l[len(l) - 1])
	elif i == len(l) - 1:
		mi = abs(l[len(l) - 1] - l[len(l) - 2])
		ma = abs(l[len(l) - 1] - l[0])
	else:
		mi = min(abs(l[i] - l[i + 1]), abs(l[i] - l[i - 1]))
		ma = max(abs(l[i] - l[0]), abs(l[i] - l[len(l) - 1]))
	res.append(list((mi, ma)))
for i in res:
	print(' '.join(map(str, i)))


n = int(input())
ar = sorted(list(map(int, input().split())))
for i in range(n):
	max1 = max(ar[n - 1] - ar[i], ar[i] - ar[0])
	if i - 1 >= 0 and i + 1 <= n - 1:
		min1 = min(ar[i] - ar[i - 1], ar[i + 1] - ar[i])
	elif i - 1 >= 0 and i + 1 > n - 1:
		min1 = ar[i] - ar[i - 1]
	else:
		min1 = ar[i + 1] - ar[i]
	print(min1, max1)


n = int(input())
l = [int(x) for x in input().split()]
for i in range(n):
	c = []
	if i == 0:
		c.append(l[i + 1] - l[i])
		c.append(l[-1] - l[i])
	elif i == n - 1:
		c.append(l[i] - l[i - 1])
		c.append(l[i] - l[0])
	else:
		c.append(min(l[i] - l[i - 1], l[i + 1] - l[i]))
		c.append(max(l[i] - l[0], l[-1] - l[i]))
	print(*c)


from sys import stdout
n = int(input())
x = [int(y) for y in input().split()]
stdout.write(str(x[1] - x[0]) + ' ' + str(x[n - 1] - x[0]) + '\n')
for i in range(1, n - 1):
	stdout.write(str(min(x[i + 1] - x[i], x[i] - x[i - 1])) + ' ' + str(max(x[n - 1] - x[i], x[i] - x[0])) + '\n')
stdout.write(str(x[n - 1] - x[n - 2]) + ' ' + str(x[n - 1] - x[0]) + '\n')


def min_max_dist(nums):
	ans = [(nums[1] - nums[0], nums[-1] - nums[0])]
	for i in range(1, len(nums) - 1):
		ans.append((min(nums[i] - nums[i - 1], nums[i + 1] - nums[i]), max(nums[i] - nums[0], nums[-1] - nums[i])))
	ans.append((nums[-1] - nums[-2], nums[-1] - nums[0]))
	return ans
n = int(input())
nums = list(map(int, input().split()))
res = min_max_dist(nums)
for r in res:
	print(str(r[0]) + ' ' + str(r[1]))


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


q = int(input())
towns = list(map(int, input().split()))
for (i, town) in enumerate(towns):
	maxdis = abs(town - towns[0])
	maxdis_0 = abs(town - towns[-1])
	mindis = town - towns[i - 1] if i > 0 else float('inf')
	mindis_0 = abs(town - towns[i + 1]) if i < q - 1 else mindis
	print(min(mindis, mindis_0), max(maxdis, maxdis_0))


n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	c1 = 0
	if i + 1 < len(a):
		g = abs(a[len(a) - 1] - a[i])
		c1 = -1
	else:
		g = -10000000000000000000
	if i - 1 >= 0:
		h = abs(a[i] - a[0])
		c1 = -1
	else:
		h = -10000000000000000000
	if c1 != -1:
		max_ = 0
	else:
		max_ = max(g, h)
	c1 = 0
	if i + 1 < len(a):
		g = abs(a[i + 1] - a[i])
		c1 = -1
	else:
		g = 10000000000000000000
	if i - 1 >= 0:
		h = abs(a[i] - a[i - 1])
		c1 = -1
	else:
		h = 10000000000000000000
	if c1 != -1:
		min_ = 0
	else:
		min_ = min(g, h)
	print(min_, max_)


number_of_cities = int(input())
city_location = [int(x) for x in input().split()]
for i in range(number_of_cities):
	if i == 0:
		next_city = city_location[i + 1] - city_location[i]
		minimum_cost = next_city
	elif i == number_of_cities - 1:
		previous_city = city_location[i] - city_location[i - 1]
		minimum_cost = previous_city
	else:
		next_city = city_location[i + 1] - city_location[i]
		previous_city = city_location[i] - city_location[i - 1]
		minimum_cost = min(previous_city, next_city)
	first_city = city_location[i] - city_location[0]
	last_city = city_location[-1] - city_location[i]
	maximum_cost = max(first_city, last_city)
	print(minimum_cost, maximum_cost)


n = int(input())
cit = list(map(int, input().split()))
lista = []
for i in range(n):
	mx = max(abs(cit[i] - cit[0]), abs(cit[i] - cit[-1]))
	if i == 0:
		mn = abs(cit[i] - cit[i + 1])
	elif i == n - 1:
		mn = abs(cit[i] - cit[i - 1])
	else:
		mn = min(abs(cit[i] - cit[i - 1]), abs(cit[i] - cit[i + 1]))
	lista.append([mn, mx])
for i in lista:
	print(*i)


x = int(input())
lista = list(map(int, input().split()))
print(abs(lista[0] - lista[1]), lista[-1] - lista[0])
for i in range(1, x - 1):
	print(abs(min(lista[i] - lista[i - 1], abs(lista[i] - lista[i + 1]))), max(lista[i] - lista[0], abs(lista[i] - lista[-1])))
print(abs(lista[-1] - lista[-2]), abs(lista[-1] - lista[0]))


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


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

def calc_diff(a, b):
	if a * b < 0:
		return abs(a) + abs(b)
	return abs(abs(a) - abs(b))
print(calc_diff(cities[0], cities[1]), calc_diff(cities[0], cities[-1]))
for i in range(1, n - 1):
	print(min(calc_diff(cities[i], cities[i - 1]), calc_diff(cities[i], cities[i + 1])), max(calc_diff(cities[i], cities[0]), calc_diff(cities[i], cities[-1])))
print(calc_diff(cities[-2], cities[-1]), calc_diff(cities[0], cities[-1]))


a = int(input())
b = list(map(int, input().split()))
for i in range(len(b)):
	if i == 0:
		print(abs(b[i] - b[i + 1]), abs(b[i] - b[len(b) - 1]))
	elif i == len(b) - 1:
		print(abs(b[i] - b[i - 1]), abs(b[i] - b[0]))
	else:
		print(min(abs(b[i] - b[i - 1]), abs(b[i] - b[i + 1])), max(abs(b[i] - b[0]), abs(b[i] - b[len(b) - 1])))


qntd = int(input(''))
entrada = input('').split(' ')
for value in range(len(entrada)):
	entrada[value] = int(entrada[value])
for i in range(len(entrada)):
	min = 0
	max = 0
	if i == 0:
		min = abs(entrada[1] - entrada[0])
		max = abs(entrada[0] - entrada[len(entrada) - 1])
	elif i == len(entrada) - 1:
		min = abs(entrada[i] - entrada[i - 1])
		max = abs(entrada[0] - entrada[len(entrada) - 1])
	else:
		minE = abs(entrada[i] - entrada[i - 1])
		minD = abs(entrada[i] - entrada[i + 1])
		if minE < minD:
			min = minE
		else:
			min = minD
		maxE = abs(entrada[0] - entrada[i])
		maxD = abs(entrada[i] - entrada[len(entrada) - 1])
		if maxE > maxD:
			max = maxE
		else:
			max = maxD
	print(str(min) + ' ' + str(max))


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 = []
	for i in range(n):
		mi = inf
		ma = max(a[i] - a[0], a[-1] - a[i])
		if i > 0:
			mi = a[i] - a[i - 1]
		if i < n - 1:
			if mi > a[i + 1] - a[i]:
				mi = a[i + 1] - a[i]
		r.append('{} {}'.format(mi, ma))
	return '\n'.join(map(str, r))
print(main())


m = []
x = int(input())
if 2 <= x <= 10 ** 5:
	z = [int(c) for c in input().split()]
	if len(z) == x:
		for v in range(len(z)):
			if v == 0:
				b1 = z[1] - z[0]
				b2 = z[-1] - z[0]
				n = (b1, b2)
				m.append(n)
			elif v == len(z) - 1:
				b1 = z[-1] - z[-2]
				b2 = z[-1] - z[0]
				n = (b1, b2)
				m.append(n)
			else:
				b1 = z[v] - z[v - 1]
				b11 = z[v + 1] - z[v]
				if b1 > b11:
					b1 = b11
				b2 = z[-1] - z[v]
				b22 = z[v] - z[0]
				if b22 > b2:
					b2 = b22
				n = (b1, b2)
				m.append(n)
		for a in m:
			print(a[0], end=' ')
			print(a[1])


n = int(input())
a = list(map(int, input().split()))
for (i, x) in enumerate(a):
	mn = int(2000000000.0)
	mx = int(-2000000000.0)
	if i > 0:
		mn = min(mn, x - a[i - 1])
		mx = max(mx, x - a[0])
	if i < n - 1:
		mn = min(mn, a[i + 1] - x)
		mx = max(mx, a[-1] - x)
	print(mn, mx)


def Max(a, b):
	if a > b:
		return a
	else:
		return b

def Min(a, b):
	if a < b:
		return a
	else:
		return b
n = input()
n = int(n)
a = [int(x) for x in input().split()]
max = []
min = []
for i in range(0, n):
	max.append(Max(a[i] - a[0], a[n - 1] - a[i]))
	if i == 0:
		min.append(a[i + 1] - a[i])
	elif i == n - 1:
		min.append(a[i] - a[i - 1])
	else:
		min.append(Min(a[i] - a[i - 1], a[i + 1] - a[i]))
	print(min[i], end=' ')
	print(max[i], end='\n')


n = int(input())

def intmaker(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
cities = intmaker(input().split())
for i in range(n):
	if i == 0:
		print(abs(cities[i + 1] - cities[i]), end=' ')
		print(abs(cities[n - 1] - cities[0]))
	elif i == n - 1:
		print(abs(cities[i] - cities[i - 1]), end=' ')
		print(abs(cities[i] - cities[0]))
	else:
		farthest = max(abs(cities[i] - cities[0]), abs(cities[n - 1] - cities[i]))
		closest = min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))
		print(closest, end=' ')
		print(farthest)


n = int(input())
x = [int(j) for j in input().split(' ')]
result = []
index = 0
while index <= n - 1:
	if index == 0:
		distance_min = x[index + 1] - x[index]
		distance_max = x[n - 1] - x[index]
		result.append(str(distance_min) + ' ' + str(distance_max))
	elif index == n - 1:
		distance_min = x[index] - x[index - 1]
		distance_max = x[index] - x[0]
		result.append(str(distance_min) + ' ' + str(distance_max))
	else:
		distance_min = min(x[index] - x[index - 1], x[index + 1] - x[index])
		distance_max = max(x[index] - x[0], x[n - 1] - x[index])
		result.append(str(distance_min) + ' ' + str(distance_max))
	index += 1
for i in result:
	print(i)


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


n = int(input())
entrada = input().split(' ')
inicio = int(entrada[0])
fim = int(entrada[n - 1])
m = int(entrada[n // 2])
for i in range(len(entrada) + 1):
	x = 0
	y = 0
	if i == len(entrada) - 1:
		x = abs(inicio - fim)
		y = abs(fim - int(entrada[i - 1]))
		print(y, x)
		break
	if abs(int(entrada[i]) - fim) > abs(int(entrada[i]) - inicio):
		x = abs(int(entrada[i]) - fim)
	elif abs(int(entrada[i]) - fim) < abs(int(entrada[i]) - inicio):
		x = abs(int(entrada[i]) - inicio)
	else:
		x = abs(int(entrada[i]) - fim)
	if i == 0 and len(entrada) > 1:
		y = abs(int(entrada[i]) - int(entrada[i + 1]))
	elif abs(int(entrada[i]) - int(entrada[i + 1])) > abs(int(entrada[i]) - int(entrada[i - 1])):
		y = abs(int(entrada[i]) - int(entrada[i - 1]))
	else:
		y = abs(int(entrada[i]) - int(entrada[i + 1]))
	print(y, x)


n = int(input())
points = [-3 * 10 ** 9] + [k for k in map(int, input().split())] + [3 * 10 ** 9]
for i in range(1, n + 1):
	nearest = min(points[i] - points[i - 1], points[i + 1] - points[i])
	farthest = max(points[i] - points[1], points[n] - points[i])
	print('{} {}'.format(nearest, farthest))


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


n = input().split()
s = list(map(int, input().split()))
s.sort()
for i in range(0, len(s)):
	if i != 0 and i != len(s) - 1:
		a = min(abs(s[i] - s[i - 1]), abs(s[i + 1] - s[i]))
	elif i == 0:
		a = abs(s[i + 1] - s[i])
	elif i == len(s) - 1:
		a = abs(s[i] - s[i - 1])
	b = max(abs(s[i] - s[len(s) - 1]), abs(s[i] - s[0]))
	print('{} {}'.format(a, b))


no_of_cities = int(input())
city_positions = list(map(int, input().split()))
city_positions = city_positions
for i in range(no_of_cities):
	if i == 0:
		print(abs(city_positions[i + 1] - city_positions[i]), abs(city_positions[-1] - city_positions[i]))
	elif i == no_of_cities - 1:
		print(abs(city_positions[i] - city_positions[i - 1]), abs(city_positions[i] - city_positions[0]))
	else:
		min_distance = min(abs(city_positions[i + 1] - city_positions[i]), abs(city_positions[i] - city_positions[i - 1]))
		max_distance = max(abs(city_positions[i] - city_positions[0]), abs(city_positions[-1] - city_positions[i]))
		print(min_distance, max_distance)


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


n = int(input())
numbers = list(map(int, input().split()))
result = []
sub_result = []
for i in range(len(numbers)):
	if len(numbers) == 1:
		sub_result.append(0)
		sub_result.append(0)
		result.append(sub_result)
		break
	if len(numbers) > 1 and i == 0:
		sub_result.append(abs(numbers[i] - numbers[i + 1]))
		sub_result.append(abs(numbers[i] - numbers[len(numbers) - 1]))
		result.append(sub_result)
	if len(numbers) > 1 and i != 0 and (i != len(numbers) - 1):
		sub_result = []
		sub_result.append(min(abs(numbers[i] - numbers[i + 1]), abs(numbers[i] - numbers[i - 1])))
		sub_result.append(max(abs(numbers[i] - numbers[0]), abs(numbers[i] - numbers[len(numbers) - 1])))
		result.append(sub_result)
	if len(numbers) > 1 and i == len(numbers) - 1:
		sub_result = []
		sub_result.append(abs(numbers[len(numbers) - 1] - numbers[len(numbers) - 2]))
		sub_result.append(abs(numbers[0] - numbers[len(numbers) - 1]))
		result.append(sub_result)
for i in result:
	print(*i)


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


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))

def input():
	return sys.stdin.readline().rstrip('\r\n')

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


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		mini = l[i + 1] - l[i]
		maxi = l[n - 1] - l[i]
		print(mini, maxi)
	elif i == n - 1:
		mini = l[i] - l[i - 1]
		maxi = l[i] - l[0]
		print(mini, maxi)
	else:
		a = l[i] - l[i - 1]
		b = l[i + 1] - l[i]
		mini = min(a, b)
		c = l[n - 1] - l[i]
		d = l[i] - l[0]
		maxi = max(c, d)
		print(mini, maxi)


n = int(input())
x = list(map(int, input().split()))
for i in range(len(x)):
	if i == 0:
		minx = abs(x[i] - x[i + 1])
		maxx = abs(x[i] - x[-1])
	elif i == len(x) - 1:
		minx = abs(x[i] - x[i - 1])
		maxx = abs(x[i] - x[0])
	else:
		maxx = abs(x[i] - x[-1])
		if abs(x[i] - x[0]) > abs(x[i] - x[-1]):
			maxx = abs(x[i] - x[0])
		minx = abs(x[i] - x[i - 1])
		if minx > abs(x[i] - x[i + 1]):
			minx = abs(x[i] - x[i + 1])
	print(minx, maxx)


try:
	input()
	l = list(map(int, input().split()))
	for (idx, ele) in enumerate(l):
		if idx == 0:
			print(abs(ele - l[idx + 1]), abs(ele - l[-1]))
		elif idx == len(l) - 1:
			print(abs(ele - l[idx - 1]), abs(ele - l[0]))
		else:
			print(min(abs(ele - l[idx - 1]), abs(ele - l[idx + 1])), max(abs(ele - l[0]), abs(ele - l[-1])))
except:
	pass


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


import sys
input()
a = list(map(int, input().split()))
len_a = len(a)
start = a[0]
end = a[len(a) - 1]
for i in range(len_a):
	if i == 0:
		print(abs(a[i] - a[i + 1]), abs(start - end))
	elif i == len_a - 1:
		print(abs(a[i] - a[i - 1]), abs(start - end))
	else:
		print(min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1])), max(abs(a[i] - end), abs(a[i] - start)))


n = int(input())
dis = list(map(int, input().split(' ')))
result = [0] * n
for i in range(n):
	if i == 0:
		minimum = abs(dis[0] - dis[1])
		maximam = abs(dis[i] - dis[n - 1])
	elif i == n - 1:
		minimum = abs(dis[i] - dis[i - 1])
		maximam = abs(dis[i] - dis[0])
	else:
		maximam = max(abs(dis[i] - dis[n - 1]), abs(dis[i] - dis[0]))
		minimum = min(abs(dis[i] - dis[i + 1]), abs(dis[i] - dis[i - 1]))
	result[i] = str(minimum) + ' ' + str(maximam) + '\n'
print(''.join(result), end='')


def main():
	quantity = int(input())
	positions = list(map(int, input().split(' ')))
	for i in range(quantity):
		leftd = abs(positions[i] - positions[0])
		rightd = abs(positions[i] - positions[quantity - 1])
		if i == 0:
			minimo = abs(positions[0] - positions[1])
			maximo = rightd
		elif i == quantity - 1:
			minimo = abs(positions[quantity - 1] - positions[quantity - 2])
			maximo = leftd
		else:
			minimo = min(abs(positions[i] - positions[i - 1]), abs(positions[i + 1] - positions[i]))
			maximo = max(rightd, leftd)
		print(str(minimo) + ' ' + str(maximo))
	return 0
main()


import math

def get_greatest(index, array):
	if index == 0:
		return abs(array[index] - array[-1])
	elif index == len(array) - 1:
		return abs(array[index] - array[0])
	else:
		first = abs(array[index] - array[0])
		last = abs(array[index] - array[-1])
		return max(first, last)

def get_least(index, array):
	if index == 0:
		return abs(array[index] - array[1])
	elif index == len(array) - 1:
		return abs(array[index] - array[-2])
	else:
		before = abs(array[index] - array[index - 1])
		after = abs(array[index] - array[index + 1])
		return min(before, after)
n = input()
coordinates = list(map(int, input().split()))
for (index, coordinate) in enumerate(coordinates):
	print(str(get_least(index, coordinates)) + ' ' + str(get_greatest(index, coordinates)))


def main():
	n = int(input())
	x = [int(t) for t in input().split()]
	for i in range(n):
		max_distance = max(x[i] - x[0], x[n - 1] - x[i])
		min_distance = max_distance
		if i > 0:
			min_distance = min(min_distance, x[i] - x[i - 1])
		if i < n - 1:
			min_distance = min(min_distance, x[i + 1] - x[i])
		print('{0} {1}'.format(min_distance, max_distance))
main()


n = int(input())
nums = [int(num) for num in input().split(' ')]
indexUltimo = len(nums) - 1
index = -1
for coord in nums:
	index += 1
	if index == 0:
		minDiff = nums[index + 1] - coord
		maxDiff = nums[indexUltimo] - coord
	elif index == indexUltimo:
		minDiff = nums[index] - nums[index - 1]
		maxDiff = nums[index] - nums[0]
	else:
		min1Item = nums[index] - nums[index - 1]
		min2Item = nums[index + 1] - nums[index]
		max1Item = nums[index] - nums[0]
		max2Item = nums[indexUltimo] - nums[index]
		minDiff = min1Item if min1Item < min2Item else min2Item
		maxDiff = max1Item if max1Item > max2Item else max2Item
	print(minDiff, maxDiff)


n = int(input())
v = input().split()
for a in range(n):
	v[a] = int(v[a])
p = []
for c in range(n):
	if c == 0:
		minc = abs(v[c + 1] - v[c])
		maxc = abs(v[n - 1] - v[c])
		s = [minc, maxc]
		p.append(s)
	elif c == n - 1:
		minc = abs(v[c] - v[c - 1])
		maxc = abs(v[c] - v[0])
		s = [minc, maxc]
		p.append(s)
	else:
		a = abs(v[c] - v[c - 1])
		b = abs(v[c + 1] - v[c])
		if a < b:
			minc = a
		else:
			minc = b
		q = abs(v[c] - v[0])
		w = abs(v[n - 1] - v[c])
		if q > w:
			maxc = q
		else:
			maxc = w
		s = [minc, maxc]
		p.append(s)
for l in p:
	print(l[0], l[1])


queries = int(input())
coords = [int(x) for x in input().split(' ')]

def calculate_distances(queries, coords):
	for i in range(queries):
		if i != 0 and i != queries - 1:
			dist_max = max((abs(coords[i] - coords[0]), abs(coords[queries - 1] - coords[i])))
			dist_min = min((abs(coords[i] - coords[i - 1]), abs(coords[i] - coords[i + 1])))
		elif i == 0:
			dist_max = max((abs(coords[i] - coords[i + 1]), abs(coords[queries - 1] - coords[i])))
			dist_min = min((abs(coords[i] - coords[i + 1]), abs(coords[queries - 1] - coords[i])))
		else:
			dist_max = max((abs(coords[i] - coords[0]), abs(coords[i] - coords[i - 1])))
			dist_min = min((abs(coords[i] - coords[0]), abs(coords[i] - coords[i - 1])))
		print(dist_min, dist_max)
calculate_distances(queries, coords)


n = int(input())
cities = list(map(int, input().split(' ')))
(mn, mx) = (cities[0], cities[-1])
print(cities[1] - mn, mx - mn)
(mini, maxi) = (0, 0)
for i in range(1, len(cities) - 1):
	if cities[i] - cities[i - 1] < cities[i + 1] - cities[i]:
		mini = cities[i] - cities[i - 1]
	else:
		mini = cities[i + 1] - cities[i]
	if cities[i] - mn > mx - cities[i]:
		maxi = cities[i] - mn
	else:
		maxi = mx - cities[i]
	print(mini, maxi)
print(mx - cities[-2], mx - mn)


cities = int(input())
coordinate = input().split()
for i in range(cities):
	coordinate[i] = int(coordinate[i])
map_coordinate = {}
for i in range(len(coordinate)):
	map_coordinate[coordinate[i]] = i
coordinate.sort()
mins = []
maxs = []
for i in range(cities):
	if i == 0:
		maxs.append(abs(coordinate[i] - coordinate[-1]))
		mins.append(abs(coordinate[i] - coordinate[1]))
	elif i == cities - 1:
		maxs.append(abs(coordinate[i] - coordinate[0]))
		mins.append(abs(coordinate[i] - coordinate[i - 1]))
	else:
		next_min = abs(coordinate[i] - coordinate[i + 1])
		previous_min = abs(coordinate[i] - coordinate[i - 1])
		next_max = abs(coordinate[i] - coordinate[-1])
		previous_max = abs(coordinate[i] - coordinate[0])
		if next_min < previous_min:
			mins.append(next_min)
		else:
			mins.append(previous_min)
		if next_max > previous_max:
			maxs.append(next_max)
		else:
			maxs.append(previous_max)
for i in range(cities):
	index = map_coordinate[coordinate[i]]
	print(str(mins[index]) + ' ' + str(maxs[index]))


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


n = int(input())
cities = list(map(int, input().split()))
for i in range(n):
	maxValue = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[-1]))
	if i == 0:
		minValue = abs(cities[i] - cities[i + 1])
	elif i == n - 1:
		minValue = abs(cities[i] - cities[i - 1])
	else:
		minValue = min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))
	print(minValue, maxValue)


n = int(input())
c = list(map(int, input().split()))
for i in range(n):
	c_max = max(abs(c[-1] - c[i]), abs(c[i] - c[0]))
	c_min = 10 ** 15
	if i != 0:
		c_min = min(abs(c[i] - c[i - 1]), c_min)
	if i != n - 1:
		c_min = min(abs(c[i + 1] - c[i]), c_min)
	print('%d %d' % (c_min, c_max))


def solve(arr, i, j, s):
	mi = abs(arr[i] - arr[j])
	mx = abs(arr[i] - arr[s])
	print(mi, mx)
n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		solve(arr, i, i + 1, -1)
	elif i == n - 1:
		solve(arr, i, i - 1, 0)
	else:
		mi = min(abs(arr[i] - arr[i - 1]), abs(arr[i] - arr[i + 1]))
		mx = max(abs(arr[i] - arr[-1]), abs(arr[i] - arr[0]))
		print(mi, mx)


num = int(input())
lst = input().split(' ')
for (i, v) in enumerate(lst):
	if i == 0:
		min = int(lst[1]) - int(lst[0])
		max = int(lst[len(lst) - 1]) - int(lst[0])
	elif i == int(len(lst) - 1):
		min = int(lst[i]) - int(lst[i - 1])
		max = int(lst[i]) - int(lst[0])
	else:
		min1 = int(lst[i + 1]) - int(lst[i])
		min2 = int(lst[i]) - int(lst[i - 1])
		max1 = int(lst[len(lst) - 1]) - int(lst[i])
		max2 = int(lst[i]) - int(lst[0])
		if min1 <= min2:
			min = min1
		else:
			min = min2
		if max1 >= max2:
			max = max1
		else:
			max = max2
	print('{} {}'.format(min, max))


input()
data = list(map(int, input().split()))
ds = [(data[1] - data[0], data[-1] - data[0])]
for i in range(1, len(data) - 1):
	ds.append((min(data[i + 1] - data[i], data[i] - data[i - 1]), max(data[-1] - data[i], data[i] - data[0])))
ds.append((data[-1] - data[-2], data[-1] - data[0]))
print('\n'.join(map(lambda v: str(v[0]) + ' ' + str(v[1]), ds)))


m = int(input())
b = [int(x) for x in input().split()]
mini = b[1] - b[0]
maxi = b[-1] - b[0]
print(mini, maxi)
for i in range(1, m - 1):
	d1 = b[i] - b[i - 1]
	d2 = b[i + 1] - b[i]
	mini = min(d1, d2)
	m1 = b[i] - b[0]
	m2 = b[-1] - b[i]
	maxi = max(m1, m2)
	print(mini, maxi)
mini = b[-1] - b[-2]
maxi = b[-1] - b[0]
print(mini, maxi)


n = int(input())
A = list(map(int, input().split()))
res = []
for j in range(n):
	list = []
	if j == 0:
		min1 = abs(A[j] - A[j + 1])
	elif j == n - 1:
		min1 = abs(A[j] - A[j - 1])
	else:
		min1 = min(abs(A[j] - A[j + 1]), abs(A[j] - A[j - 1]))
	max1 = max(abs(A[j] - A[0]), abs(A[j] - A[n - 1]))
	list.append(min1)
	list.append(max1)
	res.append(list)
for i in range(n):
	print(res[i][0], end=' ')
	print(res[i][1])


n = int(input())
points = list(map(int, input().split()))
for (i, p) in enumerate(points):
	if i == 0:
		min_dist = points[i + 1] - p
		max_dist = points[n - 1] - p
	elif i == n - 1:
		min_dist = p - points[i - 1]
		max_dist = p - points[0]
	else:
		min_dist = min(p - points[i - 1], points[i + 1] - p)
		max_dist = max(p - points[0], points[n - 1] - p)
	print('%s %s' % (min_dist, max_dist))


n = int(input())
a = [int(i) for i in input().split()]
a = a + a
for i in range(n):
	p = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
	q = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(p, q)


n = int(input())
a = [*map(int, input().split())]
b = sorted(a)
ans = {}
for i in range(n):
	if i == 0:
		ans[b[i]] = '{} {}'.format(b[1] - b[0], b[-1] - b[0])
	elif i == n - 1:
		ans[b[i]] = '{} {}'.format(b[i] - b[i - 1], b[i] - b[0])
	else:
		small = min(b[i] - b[i - 1], b[i + 1] - b[i])
		big = max(b[i] - b[0], b[-1] - b[i])
		ans[b[i]] = '{} {}'.format(small, big)
for i in a:
	print(ans[i])


n = input()
locations = list(map(int, input().split()))
for (idx, loc) in enumerate(locations):
	if idx == 0:
		minimum = locations[1] - loc
		maximum = locations[-1] - loc
	elif idx == len(locations) - 1:
		minimum = loc - locations[-2]
		maximum = loc - locations[0]
	else:
		minimum = min(abs(loc - locations[idx + 1]), abs(loc - locations[idx - 1]))
		maximum = max(abs(loc - locations[-1]), abs(loc - locations[0]))
	print(minimum, maximum)


import sys

def findMinimumMaxBetweenCities(cities, qtyCities):
	for i in range(qtyCities):
		currentCity = cities[i]
		minLeft = sys.maxsize
		minRight = minLeft
		if i - 1 >= 0:
			minLeft = currentCity - cities[i - 1]
		if i + 1 < qtyCities:
			minRight = cities[i + 1] - currentCity
		minDistance = min(minLeft, minRight)
		maxDistance = max(cities[qtyCities - 1] - currentCity, currentCity - cities[0])
		print('{0} {1}'.format(minDistance, maxDistance))
numOfCities = int(input())
citiesPosition = list(map(lambda x: int(x), input().split()))
findMinimumMaxBetweenCities(citiesPosition, numOfCities)


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


n = int(input())
c = list(map(int, input().split()))
for a in range(n):
	if a == 0:
		mi = c[a + 1]
		ma = c[n - 1]
		print(abs(mi - c[a]), abs(ma - c[a]))
	elif a == n - 1:
		mi = c[a - 1]
		ma = c[0]
		print(abs(mi - c[a]), abs(ma - c[a]))
	else:
		mi = min(c[a] - c[a - 1], c[a + 1] - c[a])
		ma = max(c[a] - c[0], c[n - 1] - c[a])
		print(mi, ma)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	pa = list(map(lambda x: abs(x), a))
	for i in range(len(a)):
		if i == 0:
			print(abs(a[i] - a[i + 1]), end=' ')
		elif i == len(a) - 1:
			print(abs(a[i - 1] - a[i]), end=' ')
		else:
			print(min(abs(a[i - 1] - a[i]), abs(a[i] - a[i + 1])), end=' ')
		print(max(abs(a[0] - a[i]), abs(a[-1] - a[i])))
main()


input()
l = [int(x) for x in input().split()]
s = len(l) - 1
for i in range(len(l)):
	if i == 0:
		print(l[1] - l[0], l[s] - l[0])
	elif i == s:
		print(l[s] - l[s - 1], l[s] - l[0])
	else:
		print(min(l[i] - l[i - 1], l[i + 1] - l[i]), max(l[s] - l[i], l[i] - l[0]))


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


n = int(input())
l = list(map(int, input().split()))
for x in range(n):
	if l[-1] - l[x] > l[x] - l[0]:
		max1 = l[-1] - l[x]
	else:
		max1 = l[x] - l[0]
	if x != 0 and x != n - 1:
		if l[x + 1] - l[x] < l[x] - l[x - 1]:
			min1 = l[x + 1] - l[x]
		else:
			min1 = l[x] - l[x - 1]
	elif x == 0:
		min1 = l[x + 1] - l[x]
	elif x == n - 1:
		min1 = l[x] - l[x - 1]
	print(min1, max1)


n = int(input())
cities = [int(c) for c in input().split(' ')]
for i in range(len(cities)):
	if i == 0:
		print('%d %d' % (abs(cities[1] - cities[0]), abs(cities[-1] - cities[0])))
	elif i == len(cities) - 1:
		print('%d %d' % (abs(cities[-2] - cities[-1]), abs(cities[0] - cities[-1])))
	elif abs(cities[0] - cities[i]) > abs(cities[-1] - cities[i]):
		if abs(cities[i - 1] - cities[i]) < abs(cities[i + 1] - cities[i]):
			print('%d %d' % (abs(cities[i - 1] - cities[i]), abs(cities[0] - cities[i])))
		else:
			print('%d %d' % (abs(cities[i + 1] - cities[i]), abs(cities[0] - cities[i])))
	elif abs(cities[i - 1] - cities[i]) < abs(cities[i + 1] - cities[i]):
		print('%d %d' % (abs(cities[i - 1] - cities[i]), abs(cities[-1] - cities[i])))
	else:
		print('%d %d' % (abs(cities[i + 1] - cities[i]), abs(cities[-1] - cities[i])))


n = int(input())
xs = tuple((int(x) for x in input().split(' ')))
(first, last) = (xs[0], xs[n - 1])
for (i, x) in enumerate(xs):
	if i == 0:
		print(xs[1] - x, last - x)
	elif i == n - 1:
		print(x - xs[-2], x - first)
	else:
		print(min(x - xs[i - 1], xs[i + 1] - x), max(x - first, last - x))


import math

def distance(a, b):
	return int(math.fabs(a - b))
n = int(input())
line = [int(i) for i in input().split()]
for i in range(len(line)):
	if i == 0:
		print(distance(line[i], line[i + 1]), distance(line[i], line[-1]))
	elif i == n - 1:
		print(distance(line[i], line[i - 1]), distance(line[i], line[0]))
	else:
		previousElement = line[i - 1]
		current = line[i]
		nextElement = line[i + 1]
		minimum = distance(previousElement, line[i])
		if distance(current, nextElement) < minimum:
			minimum = distance(current, nextElement)
		maximum = distance(current, line[0])
		if distance(current, line[-1]) > maximum:
			maximum = distance(current, line[-1])
		print(minimum, maximum)


n = int(input())
A = [int(i) for i in input().split()]
output1 = [min(A[i] - A[i - 1], A[i + 1] - A[i]) for i in range(1, n - 1)]
output1.append(A[n - 1] - A[n - 2])
output1.insert(0, A[1] - A[0])
output2 = [max(A[i] - A[0], A[n - 1] - A[i]) for i in range(1, n - 1)]
output2.append(A[n - 1] - A[0])
output2.insert(0, A[n - 1] - A[0])
for i in range(n):
	print(output1[i], output2[i])


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


def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	for i in range(n):
		(minn, maxx) = (10000000000.0, 0)
		if i > 0:
			minn = min(minn, abs(a[i] - a[i - 1]))
		if i < n - 1:
			minn = min(minn, abs(a[i] - a[i + 1]))
		if i != 0:
			maxx = max(maxx, abs(a[i] - a[0]))
		if i != n - 1:
			maxx = max(maxx, abs(a[i] - a[n - 1]))
		print('{0} {1}'.format(minn, maxx))
main()


n = int(input())
valores = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		c1 = valores[i] - valores[i + 1]
		c2 = valores[i] - valores[-1]
		print(abs(c1), abs(c2))
	elif i == n - 1:
		c1 = valores[i] - valores[i - 1]
		c2 = valores[i] - valores[0]
		print(abs(c1), abs(c2))
	else:
		if valores[i + 1] - valores[i] >= valores[i] - valores[i - 1]:
			r1 = valores[i] - valores[i - 1]
		else:
			r1 = valores[i + 1] - valores[i]
		if valores[-1] - valores[i] >= valores[i] - valores[0]:
			r2 = valores[-1] - valores[i]
		else:
			r2 = valores[i] - valores[0]
		print(abs(r1), abs(r2))


n = int(input())
li = list(map(int, input().strip().split()))[:n]
for i in range(len(li)):
	mx = max(abs(li[i] - li[0]), abs(li[i] - li[n - 1]))
	if i == 0:
		mn = abs(li[i] - li[i + 1])
	elif i == len(li) - 1:
		mn = abs(li[i] - li[i - 1])
	else:
		mn = min(abs(li[i] - li[i + 1]), abs(li[i] - li[i - 1]))
	print(mn, mx)


n = int(input())
cities = list(map(int, input().split()))
ends = [cities[0], cities[-1]]
for i in range(n):
	print(min(abs(cities[i - 1] - cities[i]), abs(cities[i + 1] - cities[i]) if i + 1 != n else float('inf')), max([abs(ends[j] - cities[i]) for j in range(2)]))


a = int(input())
b = list(map(int, input().split()))
for i in range(a):
	if i < a - 1:
		mn = min(abs(b[i] - b[i - 1]), abs(b[i] - b[i + 1]))
		mx = max(abs(b[i] - b[0]), abs(b[i] - b[a - 1]))
	else:
		mn = abs(b[i] - b[i - 1])
		mx = abs(b[i] - b[0])
	print(mn, mx)


n = int(input())
cities = [int(city) for city in input().split()]
print(cities[1] - cities[0], cities[-1] - cities[0])
for i in range(1, n - 1):
	if cities[i] - cities[i - 1] < cities[i + 1] - cities[i]:
		mincost = cities[i] - cities[i - 1]
	else:
		mincost = cities[i + 1] - cities[i]
	if cities[i] - cities[0] > cities[-1] - cities[i]:
		maxcost = cities[i] - cities[0]
	else:
		maxcost = cities[-1] - cities[i]
	print(mincost, maxcost)
print(cities[-1] - cities[-2], cities[-1] - cities[0])


n = int(input())
distance = []
lineland = list(map(int, input().split()))
for i in range(0, n):
	if i > 0 and i < n - 1:
		(d1, d2) = (abs(lineland[i] - lineland[i - 1]), abs(lineland[i] - lineland[i + 1]))
		(d3, d4) = (abs(lineland[i] - lineland[-1]), abs(lineland[i] - lineland[0]))
		print(min(d1, d2), max(d3, d4))
	elif i == 0:
		(d1, d2) = (abs(lineland[i] - lineland[i + 1]), abs(lineland[i] - lineland[-1]))
		print(d1, d2)
	elif i == n - 1:
		(d1, d2) = (abs(lineland[i] - lineland[i - 1]), abs(lineland[i] - lineland[0]))
		print(d1, d2)


CityNo = int(input())
Cities = [int(x) for x in input().split()]
for i in range(CityNo):
	minD = 0
	maxD = 0
	if i == 0:
		minD = Cities[i + 1] - Cities[i]
		maxD = Cities[CityNo - 1] - Cities[i]
	elif i == CityNo - 1:
		minD = Cities[i] - Cities[i - 1]
		maxD = Cities[i] - Cities[0]
	else:
		minD = min(Cities[i] - Cities[i - 1], Cities[i + 1] - Cities[i])
		maxD = max(Cities[CityNo - 1] - Cities[i], Cities[i] - Cities[0])
	print(minD, maxD)


n = int(input())
pos = [int(c) for c in input().split()]
for i in range(n):
	if i == 0:
		print(pos[i + 1] - pos[0], pos[-1] - pos[0])
	elif i == n - 1:
		print(pos[n - 1] - pos[n - 2], pos[n - 1] - pos[0])
	else:
		_min = min(pos[i] - pos[i - 1], pos[i + 1] - pos[i])
		_max = max(pos[i] - pos[0], pos[n - 1] - pos[i])
		print(_min, _max)


n = int(input())
cities = list(map(int, input().split()))
ans = []
for i in range(n):
	if i == 0:
		maxi = abs(cities[-1] - cities[0])
		mini = abs(cities[1] - cities[0])
	elif i == n - 1:
		maxi = abs(cities[-1] - cities[0])
		mini = abs(cities[-1] - cities[-2])
	else:
		min1 = abs(cities[i] - cities[i - 1])
		min2 = abs(cities[i] - cities[i + 1])
		if min1 < min2:
			mini = min1
		else:
			mini = min2
		max1 = abs(cities[i] - cities[0])
		max2 = abs(cities[i] - cities[-1])
		if max1 > max2:
			maxi = max1
		else:
			maxi = max2
	ans.append(mini)
	ans.append(maxi)
for i in range(0, 2 * n, 2):
	print(str(ans[i]) + ' ' + str(ans[i + 1]))


from sys import stdin, stdout
n = int(stdin.readline())
a = stdin.readline().rstrip()
c = [int(x) for x in a.split()]
for i in range(n):
	Max = max(abs(c[i] - c[0]), abs(c[i] - c[-1]))
	Min = min(abs(c[i] - c[(i + 1) % n]), abs(c[i] - c[i - 1]))
	print(Min, Max)


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


def landline():
	inp = list(map(int, input().split()))
	x = [(inp[1] - inp[0], inp[-1] - inp[0])]
	for i in range(1, len(inp) - 1):
		x.append((min(inp[i + 1] - inp[i], inp[i] - inp[i - 1]), max(inp[-1] - inp[i], inp[i] - inp[0])))
	x.append((inp[-1] - inp[-2], inp[-1] - inp[0]))
	print('\n'.join(map(lambda v: str(v[0]) + ' ' + str(v[1]), x)))
n = input()
landline()


num = int(input())
cities = [int(i) for i in input().split()]
print(f'{abs(cities[0] - cities[1])} {abs(cities[0] - cities[num - 1])}')
for (index, city) in enumerate(cities):
	if index != num - 1 and index != 0:
		minBetween = min(abs(city - cities[index - 1]), abs(city - cities[index + 1]))
		minEnd = max(abs(city - cities[0]), abs(city - cities[num - 1]))
		print(f'{min(minBetween, minEnd)} {max(minBetween, minEnd)}')
print(f'{abs(cities[num - 1] - cities[num - 2])} {abs(cities[num - 1] - cities[0])}', end='')


cidades = int(input())
coordenadas = [int(i) for i in input().split()]
menores = []
maiores = []

def maior(x, y, z):
	if z - y > y - x:
		return z - y
	else:
		return y - x

def menor(x, y, z):
	if z - y > y - x:
		return y - x
	else:
		return z - y
for i in range(cidades):
	if i == 0:
		menores.append(coordenadas[1] - coordenadas[0])
		maiores.append(coordenadas[cidades - 1] - coordenadas[0])
	elif i == cidades - 1:
		menores.append(coordenadas[cidades - 1] - coordenadas[cidades - 2])
		maiores.append(coordenadas[cidades - 1] - coordenadas[0])
	else:
		maiores.append(maior(coordenadas[0], coordenadas[i], coordenadas[cidades - 1]))
		menores.append(menor(coordenadas[i - 1], coordenadas[i], coordenadas[i + 1]))
for i in range(len(maiores)):
	print(str(menores[i]) + ' ' + str(maiores[i]))


n = int(input())
array = list(map(int, input().split()))
for i in range(n):
	_min = abs(array[i - 1] - array[i])
	if i + 1 < n:
		_min = min(_min, abs(array[i + 1] - array[i]))
	_max = max(abs(array[0] - array[i]), abs(array[-1] - array[i]))
	print('{} {}'.format(_min, _max))


n = int(input())
l = list(map(int, input().split()))
if n == 2:
	mini = abs(l[0] - l[1])
	print(mini, mini, sep=' ')
	print(mini, mini, sep=' ')
else:
	mini = abs(l[0] - l[1])
	maxi = abs(l[0] - l[n - 1])
	print(mini, maxi, sep=' ')
	for i in range(1, n - 1):
		p = abs(l[i] - l[i + 1])
		q = abs(l[i] - l[i - 1])
		if p > q:
			mini = q
		else:
			mini = p
		p = abs(l[0] - l[i])
		q = abs(l[i] - l[n - 1])
		if p > q:
			maxim = p
		else:
			maxim = q
		print(mini, maxim, sep=' ')
	mini = abs(l[n - 1] - l[n - 2])
	print(mini, maxi, sep=' ')


import sys
count = int(input())
cities = []
cities = list(map(int, input().split()))
for i in range(count):
	if i != 0 and i != count - 1:
		minimum = min(cities[i] - cities[i - 1], abs(cities[i] - cities[i + 1]))
		print(minimum, end='')
	elif i == 0:
		minimum = abs(cities[i] - cities[i + 1])
		print(minimum, end='')
	else:
		minimum = cities[i] - cities[i - 1]
		print(minimum, end='')
	maximum = max(cities[i] - cities[0], abs(cities[i] - cities[-1]))
	print(' ' + str(maximum))


n = int(input())
cidades = [int(x) for x in input().split()]
for i in range(n):
	if i == 0:
		mini = abs(cidades[i + 1] - cidades[i])
		maxi = abs(cidades[n - 1] - cidades[i])
	elif i == n - 1:
		mini = abs(cidades[n - 2] - cidades[i])
		maxi = abs(cidades[0] - cidades[i])
	else:
		a = abs(cidades[i - 1] - cidades[i])
		b = abs(cidades[i + 1] - cidades[i])
		mini = min(a, b)
		c = abs(cidades[0] - cidades[i])
		d = abs(cidades[n - 1] - cidades[i])
		maxi = max(c, d)
	resp = str(mini) + ' ' + str(maxi)
	print(resp)


n = int(input())
cities = list(map(int, input().split()))
print(abs(cities[1] - cities[0]), abs(cities[-1] - cities[0]))
for i in range(1, n - 1):
	minn = min(abs(cities[i] - cities[i - 1]), abs(cities[i + 1] - cities[i]))
	maxx = max(abs(cities[-1] - cities[i]), abs(cities[i] - cities[0]))
	print(minn, maxx)
print(abs(cities[-1] - cities[-2]), abs(cities[-1] - cities[0]))


x = int(input())
y = list(map(int, input().split()))
minx = min(y)
maxx = max(y)
for i in range(x):
	if i == 0:
		a = y[i + 1] - y[i]
	elif i == x - 1:
		a = y[i] - y[i - 1]
	elif i > 0:
		if y[i] - y[i - 1] <= y[i + 1] - y[i]:
			a = y[i] - y[i - 1]
		else:
			a = y[i + 1] - y[i]
	if abs(y[i] - minx) <= abs(y[i] - maxx):
		b = abs(y[i] - maxx)
	else:
		b = abs(y[i] - minx)
	print(a, b)


n = int(input())
z = list(map(int, input().split()))
z.sort()
for i in range(n):
	if i == 0:
		print(abs(z[i] - z[i + 1]), end=' ')
		print(abs(z[i] - z[-1]))
	elif i == n - 1:
		print(abs(z[-1] - z[-2]), end=' ')
		print(abs(z[-1] - z[0]))
	else:
		print(min(abs(z[i] - z[i + 1]), abs(z[i] - z[i - 1])), end=' ')
		print(max(abs(z[i] - z[0]), abs(z[i] - z[-1])))


n = int(input())
li = [int(x) for x in input().split()]
for i in range(n):
	furthest = max(abs(li[i] - li[0]), abs(li[-1] - li[i]))
	if i == 0:
		closest = li[i + 1] - li[i]
	elif i == n - 1:
		closest = li[i] - li[-2]
	else:
		closest = min(abs(li[i + 1] - li[i]), abs(li[i] - li[i - 1]))
	print(closest, furthest)


n = int(input())
v = [int(x) for x in input().split()]
a = 0
b = 0
for i in range(n):
	if i == 0:
		a = abs(v[i] - v[i + 1])
		b = abs(v[i] - v[n - 1])
	elif i == n - 1:
		a = min(abs(v[i] - v[i - 1]), abs(v[0] - v[i]))
		b = max(abs(v[i] - v[i - 1]), abs(v[0] - v[i]))
	else:
		a = min(abs(v[i] - v[i - 1]), abs(v[i] - v[i + 1]))
		b = max(abs(v[i] - v[0]), abs(v[i] - v[n - 1]))
	print(a, b)


n_cities = int(input())
cities = list(map(int, input().split()))
for i in range(n_cities):
	if i == 0:
		min_d = abs(cities[i] - cities[i + 1])
		max_d = abs(cities[i] - cities[n_cities - 1])
	elif i == n_cities - 1:
		min_d = abs(cities[i] - cities[i - 1])
		max_d = abs(cities[i] - cities[0])
	else:
		left = abs(cities[i] - cities[i - 1])
		right = abs(cities[i] - cities[i + 1])
		min_d = min(left, right)
		left = abs(cities[i] - cities[0])
		right = abs(cities[i] - cities[n_cities - 1])
		max_d = max(left, right)
	print(min_d, max_d)


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


n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
	if i == 0:
		mn = abs(a[0] - a[1])
		mx = abs(a[0] - a[-1])
	elif i == n - 1:
		mn = abs(a[i] - a[i - 1])
		mx = abs(a[0] - a[i])
	else:
		mn = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		mx = max(abs(a[i] - a[-1]), abs(a[i] - a[0]))
	print(mn, mx)


n = int(input())
string = str(input())
arr = string.split()
for i in range(n):
	arr[i] = int(arr[i])
arr2 = sorted(arr)
for i in range(n):
	maxi = max(abs(arr2[n - 1] - arr[i]), abs(arr2[0] - arr[i]))
	ind = arr2.index(arr[i])
	if ind == 0:
		mini = abs(arr2[ind + 1] - arr[i])
	elif ind == n - 1:
		mini = abs(arr2[ind - 1] - arr[i])
	else:
		mini = min(abs(arr2[ind + 1] - arr[i]), abs(arr2[ind - 1] - arr[i]))
	print(f'{mini} {maxi}')


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


n = int(input())
cits = [int(i) for i in input().split()]
res = ''
res += str(cits[1] - cits[0]) + ' ' + str(cits[n - 1] - cits[0]) + '\n'
for i in range(1, n - 1):
	res += str(min(cits[i] - cits[i - 1], cits[i + 1] - cits[i])) + ' ' + str(max(cits[i] - cits[0], cits[n - 1] - cits[i])) + '\n'
res += str(cits[n - 1] - cits[n - 2]) + ' ' + str(cits[n - 1] - cits[0])
print(res)


n = int(input())
l = list(map(int, input().split()))
print(abs(l[1] - l[0]), abs(l[-1] - l[0]))
for i in range(1, n - 1):
	a = abs(l[i + 1] - l[i])
	b = abs(l[i] - l[i - 1])
	c = abs(l[-1] - l[i])
	d = abs(l[i] - l[0])
	if a > b:
		print(b, end=' ')
	else:
		print(a, end=' ')
	if c > d:
		print(c)
	else:
		print(d)
print(abs(l[-1] - l[-2]), abs(l[-1] - l[0]))


def solve(a):
	n = len(a)
	for i in range(n):
		v1 = 0
		v2 = 0
		if i == 0:
			v1 = a[1] - a[0]
			v2 = a[n - 1] - a[0]
		elif i == n - 1:
			v1 = a[n - 1] - a[n - 2]
			v2 = a[n - 1] - a[0]
		else:
			v1 = min(a[i] - a[i - 1], a[i + 1] - a[i])
			v2 = max(a[n - 1] - a[i], a[i] - a[0])
		print('%s %s' % (v1, v2))
v = input()
data = input().split()
data = list(map(int, data))
solve(data)


citiesqntt = input()
citiesqntt = int(citiesqntt)
citiescoord = input()
mincost = 0
maxcost = 0
coords = citiescoord.split()
for k in range(0, citiesqntt):
	coords[k] = int(coords[k])
for i in range(0, citiesqntt):
	if i == 0:
		mincost = coords[1] - coords[0]
		maxcost = coords[-1] - coords[0]
	elif i == citiesqntt - 1:
		mincost = coords[-1] - coords[-2]
		maxcost = coords[-1] - coords[0]
	else:
		if coords[i] - coords[i - 1] > coords[i + 1] - coords[i]:
			mincost = coords[i + 1] - coords[i]
		else:
			mincost = coords[i] - coords[i - 1]
		if coords[i] - coords[0] > coords[-1] - coords[i]:
			maxcost = coords[i] - coords[0]
		else:
			maxcost = coords[-1] - coords[i]
	print(str(mincost) + ' ' + str(maxcost))


import math
x = int(input())
d = [int(d) for d in input().split()]
for i in range(x):
	if i == 0:
		print(d[i + 1] - d[i], abs(d[i] - d[-1]))
	elif i == x - 1:
		print(d[i] - d[i - 1], abs(d[i] - d[0]))
	else:
		print(min(abs(d[i + 1] - d[i]), abs(d[i - 1] - d[i])), max(abs(d[i] - d[0]), abs(d[i] - d[-1])))


numCities = int(input())
points = list(map(int, input().split()))
for i in range(numCities):
	minDif = 0
	maxDif = 0
	if i == 0:
		minDif = abs(points[i] - points[i + 1])
		maxDif = abs(points[i] - points[numCities - 1])
	elif i == numCities - 1:
		minDif = abs(points[i] - points[i - 1])
		maxDif = abs(points[i] - points[0])
	else:
		minDif = min(abs(points[i] - points[i - 1]), abs(points[i] - points[i + 1]))
		maxDif = max(abs(points[i] - points[0]), abs(points[i] - points[numCities - 1]))
	print(str(minDif) + ' ' + str(maxDif))


n = int(input())
line = tuple(map(int, input().split()))
for i in range(n):
	town = line[i]
	len1 = abs(town - line[0])
	len2 = abs(town - line[n - 1])
	if len1 > len2:
		maxlen = len1
	else:
		maxlen = len2
	if i == 0:
		minlen = abs(town - line[i + 1])
	elif i == n - 1:
		minlen = abs(town - line[i - 1])
	else:
		len1 = abs(town - line[i - 1])
		len2 = abs(town - line[i + 1])
		if len1 > len2:
			minlen = len2
		else:
			minlen = len1
	print(minlen, maxlen)


n = int(input())
arr = list(map(int, input().split()))
ans = []
a = []
a.append(abs(arr[0] - arr[1]))
a.append(abs(arr[-1] - arr[0]))
ans.append(a)
for i in range(1, n - 1):
	a = []
	k1 = abs(arr[i] - arr[i - 1])
	k2 = abs(arr[i] - arr[i + 1])
	if k1 < k2:
		a.append(k1)
	else:
		a.append(k2)
	k1 = abs(arr[i] - arr[-1])
	k2 = abs(arr[i] - arr[0])
	if k1 > k2:
		a.append(k1)
	else:
		a.append(k2)
	ans.append(a)
a = []
a.append(abs(arr[-1] - arr[-2]))
a.append(abs(arr[-1] - arr[0]))
ans.append(a)
for i in ans:
	print(i[0], end=' ')
	print(i[1])


n = int(input(''))
x = [int(x) for x in input('').split()]
ans = []
for i in range(n):
	el = x[i]
	mi = min(abs(el - x[i - 1]), abs(el - x[(i + 1) % n]))
	ma = max(abs(el - x[0]), abs(el - x[n - 1]))
	ans.append([mi, ma])
for i in ans:
	print(*i)


n = input()
n = int(n)
cities = list(map(int, input().split()))
greatest = cities[n - 1]
smallest = cities[0]
max_ = [0] * n
min_ = [0] * n
for i in range(n):
	max_[i] = max(greatest - cities[i], cities[i] - smallest)
	if i == 0:
		min_[i] = cities[1] - cities[0]
	elif i == n - 1:
		min_[i] = cities[n - 1] - cities[n - 2]
	else:
		min_[i] = min(cities[i] - cities[i - 1], cities[i + 1] - cities[i])
for i in range(n):
	print(str(min_[i]) + ' ' + str(max_[i]))


from sys import stdin
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
print(arr[1] - arr[0], arr[n - 1] - arr[0])
for i in range(1, n - 1):
	print(min(arr[i] - arr[i - 1], arr[i + 1] - arr[i]), max(arr[i] - arr[0], arr[n - 1] - arr[i]))
if n > 1:
	print(arr[n - 1] - arr[n - 2], arr[n - 1] - arr[0])


n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		print(abs(l[i] - l[i + 1]), end=' ')
	if i == n - 1:
		print(abs(l[i] - l[i - 1]), end=' ')
	if i != 0 and i != n - 1:
		bir = abs(l[i] - l[i - 1])
		iki = abs(l[i] - l[i + 1])
		print(min(bir, iki), end=' ')
	bir = abs(l[i] - l[0])
	iki = abs(l[i] - l[-1])
	print(max(bir, iki))


n = int(input())
cidades = input().split()
saida = []
for i in range(len(cidades)):
	s = []
	if i < len(cidades) - 1:
		proximo = int(cidades[i + 1])
	atual = int(cidades[i])
	anterior = int(cidades[i - 1])
	primeiro = int(cidades[0])
	ultimo = int(cidades[len(cidades) - 1])
	if i == 0:
		s.append(proximo - atual)
	elif i == len(cidades) - 1:
		s.append(atual - anterior)
	elif proximo - atual < atual - anterior:
		s.append(proximo - atual)
	else:
		s.append(atual - anterior)
	if i == 0:
		s.append(ultimo - atual)
	elif i == len(cidades) - 1:
		s.append(atual - primeiro)
	elif ultimo - atual > atual - primeiro:
		s.append(ultimo - atual)
	else:
		s.append(atual - primeiro)
	saida.append(s)
for j in saida:
	print(*j)


n = int(input())
lt = list(input().split())
for i in range(n):
	lt[i] = int(lt[i])
print(lt[1] - lt[0], lt[n - 1] - lt[0])
for i in range(1, n - 1):
	k = []
	if lt[i] - lt[i - 1] > lt[i + 1] - lt[i]:
		k.append(lt[i + 1] - lt[i])
	else:
		k.append(lt[i] - lt[i - 1])
	if lt[i] - lt[0] > lt[n - 1] - lt[i]:
		k.append(lt[i] - lt[0])
	else:
		k.append(lt[n - 1] - lt[i])
	print(k[0], k[1])
print(lt[n - 1] - lt[n - 2], lt[n - 1] - lt[0])


a = int(input(''))
d = list(map(int, input('').split()))
f = []
for i in range(len(d)):
	if i == 0:
		mind = abs(d[i] - d[i + 1])
	elif i == len(d) - 1:
		mind = abs(d[i] - d[i - 1])
	else:
		mind = min(abs(d[i] - d[i - 1]), abs(d[i] - d[i + 1]))
	f.append(mind)
	if i == 0:
		maxd = abs(d[i] - d[len(d) - 1])
	elif i == len(d):
		maxd = abs(d[i] - d[0])
	else:
		maxd = max(abs(d[i] - d[len(d) - 1]), abs(d[i] - d[0]))
	f.append(maxd)
for i in range(0, len(f), 2):
	print(str(f[i]) + ' ' + str(f[i + 1]))


n = int(input())
cit = list(map(int, input().split()))
fur = [cit[0], cit[-1]]
ans = []
for x in range(len(cit)):
	sub = []
	if x != len(cit) - 1:
		if abs(cit[x] - cit[x - 1]) < abs(cit[x] - cit[x + 1]):
			sub.append(str(abs(cit[x] - cit[x - 1])))
		else:
			sub.append(str(abs(cit[x] - cit[x + 1])))
	else:
		sub.append(str(abs(cit[x] - cit[x - 1])))
	if abs(cit[x] - cit[0]) > abs(cit[x] - cit[-1]):
		sub.append(str(abs(cit[x] - cit[0])))
	else:
		sub.append(str(abs(cit[x] - cit[-1])))
	ans.append(sub)
for y in ans:
	print(' '.join(y))


class City:

	def __init__(self, x):
		self.x = x
n = int(input())
cities = list(map(City, map(int, input().split())))
cities[0].min = cities[1].x - cities[0].x
cities[0].max = cities[-1].x - cities[0].x
cities[-1].min = cities[-1].x - cities[-2].x
cities[-1].max = cities[0].max
for i in range(2, n):
	a = cities[i].x - cities[i - 1].x
	b = cities[i - 1].x - cities[i - 2].x
	cities[i - 1].min = min(a, b)
	c = cities[-1].x - cities[i - 1].x
	d = cities[i - 1].x - cities[0].x
	cities[i - 1].max = max(c, d)
result = ['%d %d' % (city.min, city.max) for city in cities]
print('\n'.join(result))


import sys
input = sys.stdin.readline
n = int(input())
s = list(map(int, input().split()))
for i in range(n):
	(mn, mx) = (0, 0)
	if i == 0:
		(mn, mx) = (abs(s[i] - s[i + 1]), abs(s[i] - s[n - 1]))
	elif i == n - 1:
		(mx, mn) = (abs(s[i] - s[0]), abs(s[i] - s[i - 1]))
	else:
		(mn, mx) = (min(abs(s[i] - s[i + 1]), abs(s[i] - s[i - 1])), max(abs(s[i] - s[0]), abs(s[i] - s[n - 1])))
	print(f'{mn} {mx}')


import sys
x = input()
d = input().split()
v = len(d)
for i in range(0, v):
	if i > 0 and i < v - 1:
		t = abs(int(d[i]) - int(d[i - 1]))
		s = abs(int(d[i]) - int(d[i + 1]))
		m = min(t, s)
		if abs(int(d[i]) - int(d[0])) < abs(int(d[v - 1]) - int(d[i])):
			f = abs(int(d[v - 1]) - int(d[i]))
		else:
			f = abs(int(d[i]) - int(d[0]))
		print(m, f)
	else:
		if i == 0:
			m = abs(int(d[0]) - int(d[1]))
			f = abs(int(d[0]) - int(d[v - 1]))
		else:
			m = abs(int(d[v - 1]) - int(d[v - 2]))
			f = abs(int(d[0]) - int(d[v - 1]))
		print(m, f)


cities = int(input())
cities_coordinate = list(map(int, input().split()))
i = 0
rang = cities - 1
while i < cities:
	if i == 0:
		forw_ind = i + 1
		min1 = cities_coordinate[forw_ind] - cities_coordinate[i]
		max1 = cities_coordinate[rang] - cities_coordinate[i]
	elif i == rang:
		back_ind = i - 1
		min1 = cities_coordinate[i] - cities_coordinate[back_ind]
		max1 = cities_coordinate[i] - cities_coordinate[0]
	else:
		forw_ind = i + 1
		back_ind = i - 1
		max1 = max(cities_coordinate[i] - cities_coordinate[0], cities_coordinate[rang] - cities_coordinate[i])
		min1 = min(cities_coordinate[i] - cities_coordinate[back_ind], cities_coordinate[forw_ind] - cities_coordinate[i])
	print(str(min1) + ' ' + str(max1))
	i += 1


from sys import stdin, stdout
input = stdin.readline
n = int(input())
x = list(map(int, input().split()))
mi = [0] * n
x = [-float('inf')] + x + [float('inf')]
for i in range(1, n + 1):
	mi[i - 1] = min(x[i] - x[i - 1], x[i + 1] - x[i])
for i in range(n):
	stdout.write(str(mi[i]) + ' ')
	ma1 = x[n] - x[i + 1]
	ma2 = x[i + 1] - x[1]
	stdout.write(str(max(ma1, ma2)) + '\n')


def valorMaisProximo(pos, valores):
	if pos == 0:
		return valores[1] - valores[pos]
	elif pos == len(valores) - 1:
		return valores[pos] - valores[pos - 1]
	elif valores[pos] - valores[pos - 1] <= valores[pos + 1] - valores[pos]:
		return valores[pos] - valores[pos - 1]
	else:
		return valores[pos + 1] - valores[pos]

def valorMaisLonge(pos, valores):
	if pos == 0:
		return valores[-1] - valores[pos]
	elif pos == len(valores) - 1:
		return valores[pos] - valores[0]
	elif valores[-1] - valores[pos] >= valores[pos] - valores[0]:
		return valores[-1] - valores[pos]
	else:
		return valores[pos] - valores[0]
num = int(input())
entrada = input().split()
valores = [int(valor) for valor in entrada]
for i in range(len(entrada)):
	min = valorMaisProximo(i, valores)
	max = valorMaisLonge(i, valores)
	print('{} {}'.format(min, max))


n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	city = x[i]
	if i == 0:
		nearest = abs(x[i] - x[i + 1])
		farthest = abs(x[i] - x[n - 1])
	elif i == n - 1:
		nearest = abs(x[i] - x[i - 1])
		farthest = abs(x[i] - x[0])
	else:
		if abs(x[i] - x[0]) < abs(x[i] - x[n - 1]):
			farthest = abs(x[i] - x[n - 1])
		else:
			farthest = abs(x[i] - x[0])
		if abs(x[i] - x[i - 1]) < abs(x[i] - x[i + 1]):
			nearest = abs(x[i] - x[i - 1])
		else:
			nearest = abs(x[i] - x[i + 1])
	print(nearest, farthest)


def main():
	n = int(input())
	cities = list(map(int, input().split()))
	for i in range(n):
		if i == 0:
			min_d = abs(cities[i] - cities[1])
			max_d = abs(cities[i] - cities[-1])
		elif i == n - 1:
			min_d = abs(cities[i] - cities[-2])
			max_d = abs(cities[i] - cities[0])
		else:
			min_d = min(abs(cities[i] - cities[i - 1]), abs(cities[i] - cities[i + 1]))
			max_d = max(abs(cities[i] - cities[-1]), abs(cities[i] - cities[0]))
		print(min_d, max_d)
main()


n = int(input())
nums = list(map(int, input().split()))
print(nums[1] - nums[0], nums[len(nums) - 1] - nums[0])
for i in range(1, len(nums) - 1):
	k = min(nums[i] - nums[i - 1], nums[i + 1] - nums[i])
	p = max(nums[i] - nums[0], nums[len(nums) - 1] - nums[i])
	print(k, p)
print(nums[len(nums) - 1] - nums[len(nums) - 2], nums[len(nums) - 1] - nums[0])


x = int(input())
y = input().split()
for i in range(x):
	minimo = 0
	maximo = 0
	item = int(y[i])
	if i == 0:
		minimo = int(y[1]) - item
		maximo = int(y[x - 1]) - item
	elif i == x - 1:
		minimo = int(y[x - 2]) - item
		maximo = int(y[0]) - item
	else:
		if abs(int(y[i - 1]) - item) < abs(int(y[i + 1]) - item):
			minimo = int(y[i - 1]) - item
		else:
			minimo = int(y[i + 1]) - item
		if abs(int(y[0]) - item) > abs(int(y[x - 1]) - item):
			maximo = int(y[0]) - item
		else:
			maximo = int(y[x - 1]) - item
	print(abs(minimo), abs(maximo))


n = int(input())
loc = [int(x) for x in input().split(' ')]
i = 0
while i < n:
	if i == 0:
		print(loc[i + 1] - loc[i], end=' ')
		print(loc[n - 1] - loc[i])
	elif i == n - 1:
		print(loc[i] - loc[i - 1], end=' ')
		print(loc[i] - loc[0])
	else:
		minr = loc[i + 1] - loc[i]
		minl = loc[i] - loc[i - 1]
		maxr = loc[n - 1] - loc[i]
		maxl = loc[i] - loc[0]
		print(minr, end=' ') if minr <= minl else print(minl, end=' ')
		print(maxr) if maxr >= maxl else print(maxl)
	i += 1


def ans(arr):
	x = sorted(arr)
	for i in range(len(arr)):
		currentIndex = bsearch(x, arr[i])
		if currentIndex is 0 or currentIndex is len(x) - 1:
			if currentIndex is 0:
				minimum = x[currentIndex + 1] - x[currentIndex]
				maximum = x[len(x) - 1] - x[currentIndex]
				pass
			elif currentIndex is len(x) - 1:
				minimum = x[currentIndex] - x[currentIndex - 1]
				maximum = x[currentIndex] - x[0]
				pass
			pass
		else:
			minimum = min(x[currentIndex] - x[currentIndex - 1], x[currentIndex + 1] - x[currentIndex])
			maximum = max(x[currentIndex] - x[0], x[len(x) - 1] - x[currentIndex])
		print('%d %d' % (minimum, maximum))
		pass
	pass

def bsearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] is x:
			return mid
		elif arr[mid] > x:
			r = mid - 1
		else:
			l = mid + 1
	return -1
n = int(input())
arr = list(map(int, input().strip().split(' ')))
ans(arr)


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
num = int(z())
arr = zzz()
arr = [(i, j) for (j, i) in enumerate(arr)]
arr = sorted(arr)
ans = [[0, 0]] * num
for i in range(1, num - 1):
	ans[arr[i][1]] = (min(abs(arr[i][0] - arr[i + 1][0]), abs(arr[i][0] - arr[i - 1][0])), max(abs(arr[0][0] - arr[i][0]), abs(arr[-1][0] - arr[i][0])))
ans[arr[0][1]] = (abs(arr[0][0] - arr[1][0]), abs(arr[0][0] - arr[-1][0]))
ans[arr[-1][1]] = (abs(arr[-2][0] - arr[-1][0]), abs(arr[0][0] - arr[-1][0]))
for i in ans:
	print(*i)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

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

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] <= val:
			ans = mid
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)
n = int(stdin.readline())
l = list(map(int, stdin.readline().split(' ')))
l.sort()
for i in range(n):
	if i == 0:
		stdout.write(str(l[1] - l[0]) + ' ' + str(l[n - 1] - l[0]) + '\n')
	elif i == n - 1:
		stdout.write(str(l[n - 1] - l[n - 2]) + ' ' + str(l[n - 1] - l[0]) + '\n')
	else:
		stdout.write(str(min(l[i] - l[i - 1], l[i + 1] - l[i])) + ' ' + str(max(l[i] - l[0], l[n - 1] - l[i])) + '\n')


n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	if i == 0:
		print(abs(a[0] - a[i + 1]), abs(a[-1] - a[0]))
	elif i == len(a) - 1:
		print(abs(a[-1] - a[-2]), abs(a[0] - a[-1]))
	else:
		q = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		w = max(abs(a[i] - a[-1]), abs(a[i] - a[0]))
		print(q, w)


def solve(n, x):
	print(x[1] - x[0], x[-1] - x[0])
	for i in range(1, n - 1):
		mini = min(x[i] - x[i - 1], x[i + 1] - x[i])
		maxi = max(x[-1] - x[i], x[i] - x[0])
		print(mini, maxi)
	print(x[-1] - x[-2], x[-1] - x[0])

def main():
	n = int(input())
	x = list(map(int, input().split()))
	solve(n, x)
main()


input()
a = input()
a = a.split()
integered = list(map(int, a))
maxlist = []
minlist = []
for x in integered:
	if x != integered[-1] and -x + integered[-1] > abs(-x + integered[0]):
		maxlist.append(-x + integered[-1])
	else:
		maxlist.append(x - integered[0])
for i in range(len(integered)):
	if i == len(integered) - 1:
		minlist.append(abs(integered[-1] - integered[-2]))
	elif abs(integered[i] - integered[i + 1]) < abs(integered[i] - integered[i - 1]):
		minlist.append(abs(integered[i] - integered[i + 1]))
	else:
		minlist.append(abs(integered[i] - integered[i - 1]))
result = tuple(zip(minlist, maxlist))
for (a, b) in result:
	print(a, b)


n = int(input())
x = [int(i) for i in input().split()]
i = 0
while i < n:
	if i == 0:
		mini = x[1] - x[0]
		maxi = x[-1] - x[0]
	elif i == n - 1:
		mini = x[-1] - x[-2]
		maxi = x[-1] - x[0]
	else:
		mini = min(x[i] - x[i - 1], x[i + 1] - x[i])
		maxi = max(x[-1] - x[i], x[i] - x[0])
	print(mini, maxi)
	i += 1


n = int(input())
cid = list(map(int, input().split()))
for i in range(n):
	if i == 0:
		proxcid = cid[i + 1] - cid[i]
		customin = proxcid
	elif i == n - 1:
		antcid = cid[i] - cid[i - 1]
		customin = antcid
	else:
		proxcid = cid[i + 1] - cid[i]
		antcid = cid[i] - cid[i - 1]
		customin = min(antcid, proxcid)
	primeiracid = cid[i] - cid[0]
	ultimacid = cid[-1] - cid[i]
	customax = max(primeiracid, ultimacid)
	print(customin, customax)


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007

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

def out(var):
	sys.stdout.write(str(var))

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

def stringlis():
	return list(map(str, inp().split()))

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

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def createMatrix(rowCount, colCount, dataList):
	mat = []
	for i in range(rowCount):
		rowList = []
		for j in range(colCount):
			if dataList[j] not in mat:
				rowList.append(dataList[j])
		mat.append(rowList)
	return mat

def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
import collections

def minimalFilps1(bits):
	n = len(bits)
	flipsFromLeft = [0 for i in range(n)]
	flipsFromRight = [0 for i in range(n)]
	flips = 0
	for i in range(0, n, 1):
		if bits[i] == '1':
			flips = flips + 1
		flipsFromLeft[i] = flips
	flips = 0
	i = n - 1
	while i >= 0:
		if bits[i] == '0':
			flips = flips + 1
		i = i - 1
		flipsFromRight[i] = flips
	minFlips1 = sys.maxsize
	for i in range(1, n, 1):
		if flipsFromLeft[i - 1] + flipsFromRight[i] < minFlips1:
			minFlips1 = flipsFromLeft[i - 1] + flipsFromRight[i]
	return minFlips1

def minimalFilps(bits):
	n = len(bits)
	flipsFromLeft = [0 for i in range(n)]
	flipsFromRight = [0 for i in range(n)]
	flips = 0
	for i in range(0, n, 1):
		if bits[i] == '0':
			flips = flips + 1
		flipsFromLeft[i] = flips
	flips = 0
	i = n - 1
	while i >= 0:
		if bits[i] == '1':
			flips = flips + 1
		i = i - 1
		flipsFromRight[i] = flips
	minFlips = sys.maxsize
	for i in range(1, n, 1):
		if flipsFromLeft[i - 1] + flipsFromRight[i] < minFlips:
			minFlips = flipsFromLeft[i - 1] + flipsFromRight[i]
	return minFlips

def oddn(n):
	for i in range(2, n + 1):
		if i % 2 != 0 and n % i == 0:
			return i
	return 3
n = int(input())
a = list(map(int, input().split()))
b = a.copy()
minb = 0
maxb = 0
mnxb = []
for i in range(n - 1):
	if a[i] < 0 and i == 0:
		minb = abs(a[i] - a[i + 1])
		maxb = abs(a[i] - a[n - 1])
		mnxb.append((minb, maxb))
	elif a[i] < 0 and i > 0:
		minb = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		maxb = max(abs(a[i] - a[n - 1]), abs(a[i] - a[0]))
		mnxb.append((minb, maxb))
	elif a[i] > 0 and i == 0:
		minb = abs(a[i] - a[i + 1])
		maxb = abs(a[i] - a[n - 1])
		mnxb.append((minb, maxb))
	else:
		minb = min(abs(a[i] - a[i - 1]), abs(a[i] - a[i + 1]))
		maxb = max(abs(a[i] - a[n - 1]), abs(a[i] - a[0]))
		mnxb.append((minb, maxb))
mnxb.append((abs(a[n - 1] - a[n - 2]), abs(a[n - 1] - a[0])))
for i in range(n):
	print(*mnxb[i])


n = int(input())
A = [int(_) for _ in input().split()]
for _ in range(n):
	if _ == 0:
		print(A[_ + 1] - A[_], A[-1] - A[_])
	elif _ == n - 1:
		print(A[_] - A[_ - 1], A[_] - A[0])
	else:
		x = min(A[_] - A[_ - 1], A[_ + 1] - A[_])
		y = max(A[_] - A[0], A[n - 1] - A[_])
		print(x, y)


def solve():
	n = int(input())
	cities = [int(i) for i in input().split()]
	print(abs(cities[1] - cities[0]), abs(cities[0] - cities[-1]))
	for i in range(1, n - 1):
		min_ = min(abs(cities[i] - cities[i + 1]), abs(cities[i] - cities[i - 1]))
		max_ = max(abs(cities[i] - cities[0]), abs(cities[i] - cities[n - 1]))
		print(min_, max_)
	print(abs(cities[-1] - cities[-2]), abs(cities[0] - cities[-1]))
solve()


__author__ = 'runekri3'
n = int(input())
cities = list(map(int, input().split()))
(min_city, max_city) = (min(cities), max(cities))
for (city_i, city) in enumerate(cities):
	if city_i == 0:
		min_dist = abs(city - cities[city_i + 1])
	elif city_i == n - 1:
		min_dist = abs(city - cities[city_i - 1])
	else:
		last_city = cities[city_i - 1]
		next_city = cities[city_i + 1]
		min_dist = min(abs(city - last_city), abs(city - next_city))
	max_dist = max(abs(city - min_city), abs(city - max_city))
	print(min_dist, max_dist)


T = int(input())
l = list(map(int, input().split()))
if T == 1:
	print(l[0], l[0])
elif T == 2:
	aa = l[1] - l[0]
	print(aa, aa)
	print(aa, aa)
else:
	a = l[0]
	b = l[-1]
	w = l[1] - l[0]
	q = l[-1] - l[0]
	print(w, q)
	for i in range(1, len(l) - 1):
		l1 = []
		l1.append(min(l[i + 1] - l[i], l[i] - l[i - 1]))
		l1.append(max(b - l[i], l[i] - a))
		print(*l1)
	c = l[-1] - l[-2]
	d = l[-1] - l[0]
	print(c, d)


def near_point(city, cities):
	if city == 0:
		return abs(cities[city] - cities[1])
	if city == len(cities) - 1:
		return abs(cities[city] - cities[-2])
	left_city = abs(cities[city] - cities[city - 1])
	right_city = abs(cities[city] - cities[city + 1])
	return min(left_city, right_city)

def far_point(city, cities):
	if city == 0 or city == len(cities):
		return abs(cities[0] - cities[-1])
	left_city = abs(cities[city] - cities[0])
	right_city = abs(cities[city] - cities[-1])
	return max(left_city, right_city)

def near_and_far(cities):
	for city in range(len(cities)):
		yield (near_point(city, cities), far_point(city, cities))
input()
cities = list(map(int, input().rstrip().split()))
for city in near_and_far(cities):
	print(' '.join(map(str, city)))


garbage = int(input())
a = list(map(int, input().rstrip().split(' ')))
for i in range(0, garbage - 1):
	m = min(abs(a[i] - a[i + 1]), abs(a[i - 1] - a[i]))
	ma = max(abs(a[i] - a[0]), abs(a[i] - a[-1]))
	print(m, ma)
print(abs(a[-1] - a[-2]), abs(a[-1] - a[0]))


n = int(input())
cords = list(map(int, input().split()))
solution = []
for i in range(n):
	mx = max(abs(cords[i] - cords[0]), abs(cords[i] - cords[n - 1]))
	if i == 0:
		mn = abs(cords[i] - cords[i + 1])
	elif i == n - 1:
		mn = abs(cords[i] - cords[i - 1])
	else:
		mn = min(abs(cords[i] - cords[i + 1]), abs(cords[i] - cords[i - 1]))
	solution.append((mn, mx))
for (mn, mx) in solution:
	print(mn, mx)


n = int(input())
a = list(map(int, input().split()))
d = abs
for i in range(n):
	g = g1 = 9999999999
	if n - i - 1 > 0:
		g = a[i + 1]
	if i > 0:
		g1 = a[i - 1]
	print(min(d(a[i] - g), d(a[i] - g1)), max(d(a[i] - a[0]), d(a[i] - a[n - 1])))


n = int(input())
x = [int(i) for i in input().split()]
print(str(abs(x[0] - x[1])) + ' ' + str(abs(x[0] - x[n - 1])))
for i in range(1, n - 1):
	mini = min(abs(x[i] - x[i - 1]), abs(x[i] - x[i + 1]))
	maxi = max(abs(x[i] - x[0]), abs(x[i] - x[n - 1]))
	print(str(mini) + ' ' + str(maxi))
print(str(abs(x[n - 1] - x[n - 2])) + ' ' + str(abs(x[n - 1] - x[0])))


n = int(input())
c = [int(x) for x in input().split(' ')]
for i in range(n):
	Max = max(abs(c[i] - c[0]), abs(c[i] - c[-1]))
	Min = min(abs(c[i] - c[(i + 1) % n]), abs(c[i] - c[i - 1]))
	print(Min, Max)


n = int(input())
ls = list(map(int, input().split()))
ls.append(0)
for i in range(n):
	(mn, mx) = (0, 0)
	mn = min(abs(ls[i] - ls[i - 1]), abs(ls[i + 1] - ls[i]))
	mx = max(abs(ls[i] - ls[0]), abs(ls[-2] - ls[i]))
	if i == 0:
		mn = abs(ls[i + 1] - ls[i])
		mx = abs(ls[-2] - ls[i])
	elif i == n - 1:
		mn = abs(ls[i] - ls[i - 1])
		mx = abs(ls[i] - ls[0])
	print(mn, mx)