# -*- coding: utf-8 -*-
import copy

n = int(input())
l = []
for i in range(0, n):
    l.append(int(input()))


for i, v in enumerate(l):
    origin = copy.copy(l)
    origin.pop(i)
    print(sorted(origin)[-1])
