def ehand(n,a):
    for i in range(n):
        print max(a[:i]+a[(i+1):])

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

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

    ehand(n,a)