# import itertools
# import math

import copy
import sys
input = sys.stdin.readline


def solve(N, A):
    for i in range(N - 1):
        tmp = copy.copy(A)
        tmp.pop(i)
        print(max(tmp))


N = int(input())
# S = input()
# A, B = map(int, input().split())
# A = list(map(int, input().split()))


A = []
for i in range(N):
    aa = int(input())
    A.append(aa)


solve(N, A)
