# -*- coding: utf-8 -*-

import math

if __name__ == '__main__':
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))

    for i in range(N):
        b = A[:i] + A[i+1:]
        print(max(b))
