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: interview

Starter code:

Solutions:
n = int(input())
a = list(map(int, 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 + 1] - a[i], a[i] - a[i - 1]), max(a[-1] - a[i], a[i] - a[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):
    print(min(a[i] - a[i - 1], a[i + 1] - a[i]), max(a[-1] - a[i], a[i] - a[0]))
print(a[-1] - a[-2], a[-1] - a[0])

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)


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


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

n = int(input())
x = list(map(int, 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())
a = [int(x) for x in input().split()]
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] - a[0], a[-1] - a[i]))
print(a[-1] - a[-2], a[-1] - a[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)
        


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


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

for i in range(n):
    if i == 0:
        print(str(l[1]-l[0]) + " " + str(l[n-1]-l[0]))
    elif i == n-1:
        print(str(l[n-1]-l[n-2]) + " " + str(l[n-1]-l[0]))
    else:
        print(str(min(l[i]-l[i-1], l[i+1] - l[i])) + " " + str(max(l[i]-l[0], l[n-1]-l[i])))


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


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())
a = [int(x) for x in input().split()]
for i in range(len(a)):
	if i == 0:
		print(abs(a[i] - a[i+1]), abs(a[i] - a[-1]))
	elif i == len(a) - 1:
		print(abs(a[i] - a[i-1]), abs(a[i] - 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[-1])))

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


n=int(input())
a=list(map(int,input().split()))
a.sort()
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]-a[i-1],a[i+1]-a[i]),max(a[i]-a[0],a[n-1]-a[i]))

n=int(input())
x=[0]+list(map(int,input().split()))+[0]
x[0]=2*x[1]-x[-2]
x[-1]=2*x[-2]-x[1]
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]))

def __starting_point():

    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 )
        

__starting_point()

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


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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()
#print(finish - start)


#!/usr/bin/env python3
"""
Codeforces
567 A. Lineland Mail

@author yamaton
@date 2015-08-05
"""

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


def __starting_point():
    main()

__starting_point()

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


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

for i, x in enumerate(a):
    mn = int(2e9)
    mx = int(-2e9)
    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)


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

print(str(x[1]-x[0])+ " "+ str(x[-1]- x[0]))

for i in range(n- 2):
    print(str(min(x[i+1]-x[i], x[i+2]- x[i+1]))+ " "+ str(max(x[-1]- x[i+1], x[i+1]- x[0])))
    #print("pp")
    
print(str(x[-1]- x[-2])+ " "+ str(x[-1]- x[0]))

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