import numpy as np
if __name__ == "__main__":
    N = input()
    for i in range(int(N)):
        tmpA = input()
        if i == 0:
            A = np.array(int(tmpA))
        else:
            A = np.vstack((A,np.array(int(tmpA))))
    for i in range(int(N)):
        print(np.max(np.delete(A,i,axis = 0)))
        