from copy import copy


def main():
    N = int(input())
    A_lsit = [int(input()) for _ in range(N)]
    for i in range(N):
        tmp_list = copy(A_lsit)
        tmp_list.pop(i)
        print(max(tmp_list))


if __name__ == '__main__':
    main()
