import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

for i in range(0, N, 1):
    A_temp = np.copy(A)
    A_temp[i] = 0
    print(A_temp)
    print(int(np.amax(A_temp)))
