import copy
def ehand(n,a):
    for i in range(n):
        b = copy.deepcopy(a)
        del b[i]
        print max(b)

if __name__ == '__main__':
    n = int(raw_input())
    a = []

    for i in range(n):
        a.append(int(raw_input()))

    ehand(n,a)