import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    nums = [int(input()) for _ in range(N)]

    for i in range(len(nums)):
        tmp = nums[i]
        nums[i] = 0
    
        print(max(nums))
        
        nums[i] = tmp


if __name__ == '__main__':
    main()

