import numpy as np
import sys

input = sys.stdin.readline

def main():
    
    N = int(input())
    A = [int(input()) for _ in range(N)]

    A = np.array(A)

    for i in range(N):
        print(max(np.delete(A, [i], axis=0)))

if __name__ == '__main__':
    main()