array = list(map(int, input().strip().split()))
n = array[0]
max = 0
t = len(array)
t = t-1
backup = 0

for i in range(n):
    backup = array[i+1]
    array[i+1] = 0

    for j in range(t):
        if(array[j+1] > max):
            max = array[j+1]      

    print(array)
    print(max)
    max = 0
    array[i+1] = backup
