n = int(input()) #1行目のNを取得する
list = [input() for i in range(n)] #複数行の数値の入力を取得
lint = [int(s) for s in list]

for i in range(n):
    s = lint.pop(0)
    lints = sorted(lint, reverse=True)
    ans = lints[0]
    print(ans)
    lint.append(s)