def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))
        
    for n in range(N):
        tmp = A.pop(n)
        print(max(A))
        A.insert(n, tmp)
        
if __name__ == '__main__':
    main()
