import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    for i in range(len(A)):
        a = A[:]
        a.pop(i)
        print(max(a))

if __name__ == '__main__':
    main()