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

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y) n = int(input()) n int(input()) int input() input a = list(map(int ,input().split())) a list(map(int ,input().split())) list map(int ,input().split()) map int input().split() ().split () input split a.sort(reverse=True) a.sort a sort reverse=True reverse True ans = [] ans [] for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a) i range(n) range n if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a) i == 0 i 0 tmp = a[i] tmp a[i] a i elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
     1 <= i < n - 1 1 <= i 1 i n - 1 n 1 if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
     a[i] > 0 a[i] a i 0 ans.append(str(a[-1]) + ' ' +  str(a[i])) ans.append ans append str(a[-1]) + ' ' +  str(a[i]) str(a[-1]) + ' ' str(a[-1]) str a[-1] a -1 ' ' str(a[i]) str a[i] a i a[-1] -= a[i] a[-1] a -1 a[i] a i ans.append(str(tmp) + ' ' +  str(a[i])) ans.append ans append str(tmp) + ' ' +  str(a[i]) str(tmp) + ' ' str(tmp) str tmp ' ' str(a[i]) str a[i] a i tmp -= a[i] tmp a[i] a i ans.append(str(tmp) + ' ' +  str(a[-1])) ans.append ans append str(tmp) + ' ' +  str(a[-1]) str(tmp) + ' ' str(tmp) str tmp ' ' str(a[-1]) str a[-1] a -1 a = tmp - a[-1] a tmp - a[-1] tmp a[-1] a -1 print(a) print a for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y) i range(len(ans)) range len(ans) len ans x, y = map(int, ans[i].split()) x map(int, ans[i].split()) map int ans[i].split() [i].split [i] ans i split y print(x, y) print x y y = map(int, ans[i].split()) map(int, ans[i].split()) y ans = [] [] ans tmp -= a[i] a[i] tmp x, y = map(int, ans[i].split()) map(int, ans[i].split()) x a = list(map(int ,input().split())) list(map(int ,input().split())) a n = int(input()) int(input()) n a = tmp - a[-1] tmp - a[-1] a tmp = a[i] a[i] tmp
#%%
n = int(input())
a = list(map(int ,input().split()))

a.sort(reverse=True)
ans = []
for i in range(n):
    if i == 0:
        tmp = a[i]
    elif 1 <= i < n - 1:
        if a[i] > 0:
            ans.append(str(a[-1]) + ' ' +  str(a[i]))
            a[-1] -= a[i]
        else:
            ans.append(str(tmp) + ' ' +  str(a[i]))
            tmp -= a[i]
    else:
        ans.append(str(tmp) + ' ' +  str(a[-1]))
        a = tmp - a[-1]
        print(a)

for i in range(len(ans)):
    x, y = map(int, ans[i].split())
    print(x, y)
