Harryxun/stf_run huggingface dataset:
a,b,c = map(int,input().split())

if sum(a,b,c) >= 22:
    print('bust')
else:
    print('win')

### FIXED CODE ###

a,b,c = map(int,input().split())

if a + b + c >= 22:
    print('bust')
else:
    print('win')
n=(input())
n%=10
if(n==3)
	print("bon")
else if(n==0 or n==1 or n==6 or n==8)
	print("pon")
else
	print("hon")

### FIXED CODE ###

n=int(input())
n%=10
if(n==3):
	print("bon")
elif(n==0 or n==1 or n==6 or n==8):
	print("pon")
else:
	print("hon")
#python3

def main():
    n, q = map(int, input().split())
    tree = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(lambda x: int(x)-1, input().split())
        tree[a].append(b)
    op = []
    for _ in range(q):
        p, x = map(int, input().split())
        p -= 1
        op.append((p, x))
    
    cntr = [0 for _ in range(n)]
    
    def dfs(node, p):
        lng = len(tree[node])
        cntr[node] += p
        if lng == 0:
            return
        for i in range(lng):
            next_node = tree[node][i]
            dfs(next_node, p)

    for node, p in op:
        dfs(node, p)
    for i in range(n):
        if i == n-1:
            print(cntr[i])
        else:
            print(cntr[i], end=' ')
main()


### FIXED CODE ###

#python3
from collections import deque 
def main():
    n, q = map(int, input().split())
    to = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(lambda x: int(x)-1, input().split())
        to[a].append(b)
        to[b].append(a)

    node = [0 for _ in range(n)]

    for _ in range(q):
        p, x = map(int, input().split())
        node[p-1] += x

    dq = deque() 
    dq.append(0)
    done = [0 for _ in range(n)]
    done[0] = 1
    while len(dq) > 0:
        x = dq.popleft()
        for i in to[x]:
            if done[i] == 1:
                continue
            node[i] += node[x]
            done[i] = 1 
            dq.append(i)

    for i in range(n):
        print(node[i]) if i == n-1 else print(node[i], end=' ')
main()
class Dice :
    def __init__(self,num):
        self.num = num

    def move_E(self):
        self.copy = self.num.copy() 
        for i,j in zip([0,2,5,3],[3,0,2,5]):
            self.num[i] = self.copy[j]

    def move_W(self):
        self.copy = self.num.copy()
        for i,j in zip([0,3,5,2],[2,0,3,5]):
            self.num[i] = self.copy[j]

    def move_N(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[1,5,4,0]):
            self.num[i] = self.copy[j]

    def move_S(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[4,0,1,5]):
            self.num[i] = self.copy[j]



number = list(map(int,input().split()))
#number = [1,2,4,8,16,32]
#print("1 2 3 4 5 6")
# ?????????????????????
dice = Dice(number)

for order in input():
    if order == 'S':
        dice.move_S()
    elif order == 'N':
        dice.move_N()
    elif order == 'W':
        dice.move_W()
    else:
        dice.move_E()

# ?????????????????¶????????????
#print(dice.num)

print(dice.num[0])

### FIXED CODE ###

class Dice :
    def __init__(self,num):
        self.num = num

    def move_E(self):
        self.copy = self.num.copy() 
        for i,j in zip([0,2,5,3],[3,0,2,5]):
            self.num[i] = self.copy[j]

    def move_W(self):
        self.copy = self.num.copy()
        for i,j in zip([0,3,5,2],[2,0,3,5]):
            self.num[i] = self.copy[j]

    def move_N(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[1,5,4,0]):
            self.num[i] = self.copy[j]

    def move_S(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[4,0,1,5]):
            self.num[i] = self.copy[j]



number = list(map(int,input().split()))
#number = [1,2,4,8,16,32]
#print("1 2 3 4 5 6")
# ?????????????????????
dice = Dice(number)

for order in input():
    if order == 'S':
        dice.move_S()
    elif order == 'N':
        dice.move_N()
    elif order == 'W':
        dice.move_W()
    else:
        dice.move_E()

# ?????????????????¶????????????
#print(dice.num)

print(dice.num[0])
N,M = map(int, input().split())
W = {}
for _ in range(N):
  a,b = map(int, input().split())
  if a in W:
    W[a].append(b)
  else:
    W[a] = [b]

ans = 0
for i in range(1, M+1):
  for j in range(1, i):
    if j in W.keys():
      ans += max(W[j])
      W[j].remove(max(W[j]))
print(ans)

### FIXED CODE ###

import heapq

N,M = map(int, input().split())

jobs = {}
for _ in range(N):
  a,b = map(int, input().split())
  if a > M:
    continue
  if M - a in jobs:
    jobs[M-a].append(b)
  else:
    jobs[M-a] = [b]

q = []
heapq.heapify(q)

ans = 0
for i in reversed(range(0, M)):
  if i in jobs.keys():
    for job in jobs[i]:
      heapq.heappush(q, (-job, job))
  
  if len(q) > 0:
    ans += heapq.heappop(q)[1]

print(ans)
n, k = map(int, input().split())
s = list(input())

s[k-1] = s[k-1].lower()
print('',join(s))

### FIXED CODE ###

n, k = map(int, input().split())
s = list(input())
 
s[k-1] = s[k-1].lower()
print(''.join(s))
[n,m]=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
bc=[[int(x) for x in input().split()] for _ in range(m)]

a.sort()
bc.sort(key=lambda x:x[1])
b=[]
for item in bc[::-1]:
  b=b+[item[1],]*item[0]
ans=0
print(a,b,bc)
for i in range(n):
  if a[i]<b[i]:
    ans=ans+b[i]
  elif i!=n-1:
    ans=ans+sum(a[i:])
    break
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from operator import itemgetter
 
N,M = map(int,readline().split())
a = list(map(int,readline().split()))
m = map(int,read().split())
bc = list(zip(m,m))


#[n,m]=[int(x) for x in input().split()]
#a=[int(x) for x in input().split()]
#bc=[[int(x) for x in input().split()] for _ in range(m)]

bc.sort(key = itemgetter(1),reverse=True)
bc.append((N,-1))
change=[]
for b,c in bc:
    change += [c] * b
    if len(change) > N:
        break
 
a += change
a.sort()
answer = sum(a[-N:])
print(answer)
l =input().split()
for i in range(0,2):
  a=0
  b=0
  if len(i) = 5:
    a = a+1
  if len(i) = 7:
    b = b+1
if a=2 and b=1:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = list(map(int,input().split()))
b = 0
c = 0
for i in a:
  if i == 7:
    b += 1
  elif i == 5:
    c += 1
 
if b == 1 and c == 2:
  print("YES")
else:
  print("NO")
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = list(readline().rstrip().decode('utf-8'))


res = lst1.copy()
res = "".join(res)
ct = res.count("1")
res = int(res,2)

amari_of_m = res%(ct-1)
amari_of_p = res%(ct+1)

def pow(n,p,mod): #繰り返し二乗法(nのp乗)
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

def func(res):
    ans = 1
    while True:
        ct = 0
        for i in range(len(bin(res))):
            if res>>i&1:
                ct += 1
        if res%ct == 0:
            print(ans+1)
            return
        else:
            res %= ct
            ans += 1

for i in range(n):
    #resres = (1<<(n-i-1)) if lst1[i] == "1" else (1<<(n-i-1))
    resres = pow(2,n-i-1,ct-1) if lst1[i] == "1" else pow(2,n-i-1,ct+1)
    if lst1[i] == "1":
        resres -= amari_of_m
        resres %= ct-1
    else:
        resres += amari_of_p
        resres %= ct+1
    if not resres:
        print(1)
    else:
        func(resres)


### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = list(readline().rstrip().decode('utf-8'))


res = lst1.copy()
res = "".join(res)
ct = res.count("1")
res = int(res,2)
if ct == 0:
    for i in range(n):
        print(1)
    exit()
if ct == 1:
    amari_of_m = -1
else:
    amari_of_m = res%(ct-1)
amari_of_p = res%(ct+1)

def pow(n,p,mod): #繰り返し二乗法(nのp乗)
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

def func(res):
    ans = 1
    while True:
        ct = 0
        for i in range(len(bin(res))):
            if res>>i&1:
                ct += 1
        if res%ct == 0:
            print(ans+1)
            return
        else:
            res %= ct
            ans += 1

for i in range(n):
    if lst1[i] == "1" and amari_of_m == -1:
        print(0)
        continue
    else:
        resres = pow(2,n-i-1,ct-1) if lst1[i] == "1" else pow(2,n-i-1,ct+1)
    if lst1[i] == "1":
        resres = amari_of_m - resres
        resres %= ct-1
    else:
        resres = amari_of_p + resres
        resres %= ct+1
    if not resres:
        print(1)
    else:
        func(resres)
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    pos = [a for a in A if a >= 0]
    neg = [a for a in A if a < 0]

    pos.sort()
    neg.sort(reverse=True)

    if N == K:
        vec = A
    elif N == len(neg):
        if K & 1:
            vec = neg[:K]
        else:
            vec = neg[-K:]
    else:
        ans_pos = []
        ans_neg = []
        for _ in range(K):
            if not pos:
                ans_neg.append(neg.pop())
            elif not neg:
                ans_pos.append(pos.pop())
            elif pos[-1] > -neg[-1]:
                ans_pos.append(pos.pop())
            else:
                ans_neg.append(neg.pop())
                
        if len(ans_neg) & 1 and ans_pos[-1] != 0:
            s1 = s2 = 0
            if pos and ans_neg:
                s1 = -pos[-1] / ans_neg[-1]
            if neg and ans_pos:
                s2 = -neg[-1] / ans_pos[-1]

            if s1 > s2:
                ans_pos.append(pos.pop())
                ans_neg.pop()
            else:
                ans_neg.append(neg.pop())
                ans_pos.pop()

        vec = ans_pos + ans_neg

    ans = 1
    for a in vec:
        ans = ans * a % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    pos = [a for a in A if a >= 0]
    neg = [a for a in A if a < 0]

    pos.sort()
    neg.sort(reverse=True)

    if N == K:
        vec = A
    elif N == len(neg):
        if K & 1:
            vec = neg[:K]
        else:
            vec = neg[-K:]
    else:
        ans_pos = []
        ans_neg = []
        for _ in range(K):
            if not pos:
                ans_neg.append(neg.pop())
            elif not neg:
                ans_pos.append(pos.pop())
            elif pos[-1] > -neg[-1]:
                ans_pos.append(pos.pop())
            else:
                ans_neg.append(neg.pop())

        if (len(ans_neg) & 1) and ((not ans_pos) or (ans_pos[-1] != 0)):
            if not pos or not ans_neg:
                drop_pos = True
            elif not neg or not ans_pos:
                drop_pos = False
            else:
                drop_pos = pos[-1] * ans_pos[-1] < neg[-1] * ans_neg[-1]

            if drop_pos:
                ans_neg.append(neg.pop())
                ans_pos.pop()
            else:
                ans_pos.append(pos.pop())
                ans_neg.pop()

        vec = ans_pos + ans_neg

    ans = 1
    for a in vec:
        ans = ans * a % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()
import math
n = input()
n = math.ceil(n / 2)
print(n)

### FIXED CODE ###

import math
n = int(input())
n = math.ceil(n / 2)
print(n)
n = int(input())
m = int(-1 + (n-2) ** 0.5) + 1
for i in range(n):
  cnt = 0
  for x in range(1, m):
    for y in range(1, m):
      for z in range(1, m):
        if x * x + y * y + z * z + x * y + y * z + z * x == i:
          cnt += 1
  print(cnt)

### FIXED CODE ###

n = int(input())

a = [0]*10001

for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1,101):
        v = x*x+y*y+z*z+x*y+y*z+x*z
        if  v < 10001:
        	a[v] += 1
for i in range(n):
  print(a[i+1])
S = list(raw_input())

i = 0
cnt = 0
while len(S) > 0:
    if i+1 == len(S):
        break
    if S[i] != S[i+1]:
        del S[i]
        del S[i]
        i -= 2
        cnt += 2
    i += 1

print cnt

### FIXED CODE ###

S = list(raw_input())

i = 0
cnt = 0
while len(S) > 0:
    if i+1 == len(S):
        break
    if S[i] != S[i+1]:
        del S[i]
        del S[i]
        if i <= 0:
            i = -1
        else:
            i -= 2
        cnt += 2
    i += 1

print cnt
N = int(input())
a = [int(i) for i in input().split())

c = [0] * (10**5 + 1)

for i in a:
    c[i] += 1
    if i != 0 and i != 10 ** 5:
        c[i-1] += 1
        c[i+1] += 1
    elif i == 0:
        c[i+1] += 1
    else:
        c[i-1] += 1

print(max(c))

### FIXED CODE ###

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

c = [0] * (10**5 + 1)

for i in a:
    c[i] += 1
    if i != 0 and i != 10 ** 5:
        c[i-1] += 1
        c[i+1] += 1
    elif i == 0:
        c[i+1] += 1
    else:
        c[i-1] += 1

print(max(c))
K = int(input())
S = input()

for i in range(K):
    print(S[i],end="")
if len(S) > K:
    print("...")

### FIXED CODE ###

K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    for i in range(K):
        print(S[i],end="")
    print("...")
import sys
import numpy as np
import pandas as pd

n, m = map(int, sys.stdin.readline().rstrip().split())
lines = sys.stdin.readlines()
lines = [list(map(float, line.strip().split())) for line in lines]
df = pd.DataFrame(lines,
                  columns = ["price", "stock"],
                  dtype = float
                  )
df = df.sort_values(by="price")
price = 0
for i in range(n):
    if m - df.iloc[i]["stock"] > 0:
        price += df.iloc[i]["price"] * df.iloc[i]["stock"]
        m -= df.iloc[i]["stock"]
    else:
        price += df.iloc[i]["price"] * m
        break
print(int(price))


### FIXED CODE ###

import sys
import numpy as np

n, m = map(float, input().split())
lines = sys.stdin.readlines()
lines = [list(map(float, line.strip().split())) for line in lines]
lines.sort()
price = 0
for line in lines:
    if m - line[1] > 0:
        price += line[0] * line[1]
        m -= line[1]
    else:
        price += line[0] * m
        break
print(int(price))
result = [0] * 3
while 1:
    a, b, c = sorted(list(map(int, input().split())))
    if a + b > c:
        flag = c * c - b * b - a * a
        if flag == 0:
            result[0] += 1
        elif flag > 0:
            result[1] += 1
        else:
            result[2] += 1
print(sum(result), *result)


### FIXED CODE ###

result = [0]*3
while True:
    a, b, c = sorted(map(int, input().split()))
    if a + b <= c:
        print(sum(result),*result)
        break
    flag = a ** 2 + b ** 2 - c*c
    if flag == 0:
        result[0] +=1
    elif flag >0:
        result[1] += 1
    else:
        result[2] += 1
n,m=map(int,input().split())
x=[int(i) for i in input().split()]
x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(n-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:n-m])
  
  
  



### FIXED CODE ###

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

x.sort()
y=[]
if n-m>=0:
  print(0)
  exit(0)
else:
  for i in range(m-1):
    y.append(x[i+1]-x[i])
y.sort()
print(sum(y[:m-n]))
N = int(input())
task_list = [list(map(int,input().split())) for i in range(N)]

task_list.sort(key= lambda task_list: task_list[1])
time = 0

while(len(task_list)):
    x = task_list.pop(0)
    time += x[0]
    if time > x[1]:
        print("No")
        exit(1)

    else:
        continue

print("Yes")

### FIXED CODE ###

N = int(input())
task_list = [list(map(int, input().split())) for i in range(N)]

task_list.sort(key=lambda task_list: task_list[1])
time = 0
flag = True

for i in range(N):
    x = task_list[i]
    time += x[0]
    if time > x[1]:
        flag = False
        break

if flag:
    print("Yes")

else:
    print("No")




#りゅうせいの解答1　実行時エラー、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")
import sys
import numpy
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    print("{0:.3f} {1:.3f}".format(numpy.round((c * e - b * f) / (a * e - b * d), 3), numpy.round((c * d - a * f) / (b * d - a * e), 3)))


### FIXED CODE ###

import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))
n, m = map(int, input().split())

A = []
for i in range(m):
    A.append(int(input()))
    
dp = [0 for i in range(n + 1)]
dp[0] = 1

count = 0
for i in range(n+1):
    if  i !=  A[count]:
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % (10 ** 9 + 7)
        elif i == 1:
            dp[i] += dp[i-1] % (10 ** 9 + 7)
    else:
        if count < m-1:
            count += 1
            
print(dp[-1] % (10 ** 9 + 7))

### FIXED CODE ###

n, m = map(int, input().split())
mod = 10 ** 9 + 7
A = []
for i in range(m):
    A.append(int(input()))
    
dp = [None for i in range(n + 1)]
dp[0] = 1

for a in A:
    dp[a] = 0
    
for i in range(1,n+1):
    if dp[i] != 0:
        dp[i] = 0
        if i >= 2:
            dp[i] += (dp[i-2] + dp[i-1]) % mod
        elif i == 1:
            dp[i] += dp[i-1] % mod
            
print(dp[-1])
import sys
H,W = input().split()
H = int(H)
W = int(W)
s = []

s.append("."*(W+2))
for i in range(H):
    s.append("."+input()+".")

s.append("."*(W+2))

for j in range(1,1+H):
    for i in range(1,1+W):

        if s[i][j] == "#":
            if s[i][j-1] != "#" and s[i][j+1] != "#" and s[i-1][j] != "#" and s[i+1][j] != "#":
                print("No")

                sys.exit()



print("Yes")


### FIXED CODE ###

import sys
H,W = input().split()
H = int(H)
W = int(W)
s = []

s.append("."*(W+2))
for i in range(H):
    s.append("."+input()+".")

s.append("."*(W+2))


for i in range(1,1+H):
    for j in range(1,1+W):
#        print(j,i)
        if s[i][j] == "#":
            if s[i][j-1] != "#" and s[i][j+1] != "#" and s[i-1][j] != "#" and s[i+1][j] != "#":
                print("No")

                sys.exit()

print("Yes")
import math

a, b = map(int, input().split(' '))

def gcd(a, b):
    if a % b == 0 or b % a == 0:
        return min(a, b)
    else:
        if a // b >= b // a:
            c = abs(a - b * (a // b))
        else:
            c = abs(b - a * (b // a))
        d = min(a, b)
        return gcd(c, d)

gcd_ = gcd(a, b)
d = []
for i in range(2, max(3, int(math.sqrt(gcd_))+1)):
    if not gcd_ % i:
        d.extend([i, gcd_ // i])

d.sort()
if d[0] == 1:
    del d[0]
ans = [1]

for i in d:
    for j in ans:
        if gcd(i, j) == 1 and j == ans[-1]:
            ans.append(i)
        elif gcd(i, j) != 1:
            break

print(len(ans))

### FIXED CODE ###

import math

a, b = map(int, input().split(' '))

def gcd(a, b):
    if a % b == 0 or b % a == 0:
        return min(a, b)
    else:
        if a // b >= b // a:
            c = abs(a - b * (a // b))
        else:
            c = abs(b - a * (b // a))
        d = min(a, b)
        return gcd(c, d)

gcd_ = gcd(a, b)
d = []
for i in range(1, max(4, int(math.sqrt(gcd_))+1)):
    if not gcd_ % i:
        d.extend([i, gcd_ // i])

d.sort()
while d != [] and d[0] == 1:
    del d[0]
ans = [1]

for i in d:
    for j in ans:
        if gcd(i, j) == 1 and j == ans[-1]:
            ans.append(i)
        elif gcd(i, j) != 1:
            break

print(len(ans))
a,b = int(input().split())
M = a * b
print(M)

### FIXED CODE ###

a, b = map(int,input().split())
M = a * b
S = 2 * (a + b)
print(M,S)
A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))])

### FIXED CODE ###

A,B,N=map(int,input().split())
def f(x):
  return int(A*x/B)-A*int(x/B)

print(f(min(N,B-1)))
N = int(input())
K = int(input())
n = N 
ans = 0
c = 0
co
while n > 10: #桁数を数える
    c = c + 1 
    n = n // 10
while c > 0: 
    m = N // (10 * c)
    d = m % 10
    if d == 1:
        co = co + 1
    else:
        ans = d
        break
    c = c - i
if K < co:
    ans = n
print(ans)

### FIXED CODE ###

N = int(input())
K = int(input())
n = N 
ans = n
c = 0
co = 0

while n > 10: #桁数を数える
    c = c + 1 
    n = n // 10
#print(c)
while c > -1: #上の桁から見ていく
    m = N // (10 ** c)
    d = m % 10
    #print(m)
    #print(d)
    if d == 1: # 1がどこまで連続しているかを調べる
        co = co + 1
    else:      #初めて1以外の数がでてきたらそれを一旦答えとする
        ans = d 
        break
    c = c - 1
if K <= co: #1が連続しているところを答える場合は答えは1
        ans = 1

print(ans)
a,b=(int,input().split())
print("{0} {1} {2:.8f}".format(a // b, a % b, a / b))



### FIXED CODE ###

a,b = map(int,input().split())
print("{0} {1} {2:.8f}".format(a // b, a % b, a / b))
from collections import deque

N = int(input())
A = [int(i) for i in input().split()]
p = deque()
m = deque()

A.sort(reverse=True)
for i in A:
    if i > 0:
        p.append(i)
    else:
        m.append(i)

ans = []
for _ in range(N-2):
    if p and m:
        if len(p) < len(m):
            tt = p.popleft()
            zz = m.pop()
            p.appendleft(tt-zz)
            ans.append([tt,zz])
        else:
            tt = m.pop()
            zz = p.popleft()
            m.append(tt-zz)
            ans.append([tt,zz])
    elif p:
        tt = p.pop()
        zz = p.popleft()
        m.append(tt-zz)
        ans.append([tt,zz])

    else:
        tt = m.popleft()
        zz = m.pop()
        p.append(tt-zz)
        ans.append([tt,zz])

if p and m:
    tt = p.pop()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)
else:
    tt = p.popleft()
    zz = p.pop()
    ans.append([tt,zz])
    print(tt-zz)

for i in range(N-1):
    tt,zz = ans[i]
    print(tt,zz)


### FIXED CODE ###

from collections import deque

N = int(input())
A = [int(i) for i in input().split()]
p = deque()
m = deque()

A.sort(reverse=True)
for i in A:
    if i > 0:
        p.append(i)
    else:
        m.append(i)

ans = []
for _ in range(N-2):
    if p and m:
        if len(p) < len(m):
            tt = p.popleft()
            zz = m.pop()
            p.appendleft(tt-zz)
            ans.append([tt,zz])
        else:
            tt = m.pop()
            zz = p.popleft()
            m.append(tt-zz)
            ans.append([tt,zz])
    elif p:
        tt = p.pop()
        zz = p.popleft()
        m.append(tt-zz)
        ans.append([tt,zz])

    else:
        tt = m.popleft()
        zz = m.pop()
        p.append(tt-zz)
        ans.append([tt,zz])

if p and m:
    tt = p.pop()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)

elif p:
    tt = p.popleft()
    zz = p.pop()
    ans.append([tt,zz])
    print(tt-zz)

else:
    tt = m.popleft()
    zz = m.pop()
    ans.append([tt,zz])
    print(tt-zz)

for i in range(N-1):
    tt,zz = ans[i]
    print(tt,zz)
a,b = map(int, input())
ans = 1
while True:
    if (ans%a + ans%b) == 0:
        print(ans)
        break
    ans += 1

### FIXED CODE ###

ab = list(map(int, input().split()))
a = max(ab)
b = min(ab)
r = a%b
while r!=0:
    a = b
    b = r
    r = a%b
print(int(max(ab) * min(ab)/b))