import numpy as np

def main():
    
    N = int(input())
    A = []
    for i in range(N):
        A.append(input())

    A = np.array(A)

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

if __name__ == '__main__':
    main()