import numpy as np
import copy
def main():
    n = int(input())
    
    ans_list = []
    for i in range(n):
        a = int(input())
        ans_list.append(a)

    for j in range(n):
        tmp_list = copy.deepcopy(ans_list)
        tmp_list[j] = 0
    
        print(np.max(tmp_list))



    
    
if __name__ == '__main__':
    main()

