# coding:utf-8
def main():
    a = int(input())
    list = []
    for i in range(a):
        list.append(int(input()))
    temp = list.copy()

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

if __name__ == '__main__' :
    main()