from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())

for i in range(N):
    B = A[:]
    B.pop(i)
    print(max(B))
