import sys
input = sys.stdin.readline
import math
def print_ans(N, ar):
    """Test Case
    >>> print_ans(3, [1, 4, 3])
    4
    3
    4
    >>> print_ans(2, [5, 5])
    5
    5
    """
    for i in range(N):
        ans_max = 1
        for k in range(N):
            if i != k:
                ans_max = max(ans_max, ar[k])
        print(ans_max)

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = [int(input().rstrip()) for i in range(N)]
    print_ans(N, ar)
