# coding:utf-8
def main():
    a = int(input())
    lists = []
    lists= [int(input()) for _ in range(a)]

    temp = lists.copy()

    for i in range(a):
        lists = temp.copy()
        lists.pop(i)
        ans = max(lists)
        print(ans)

if __name__ == '__main__' :
    main()