def main():
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))
    for j in range(N):
        a = A[j]
        A[j] = -1
        print(max(A))
        A[j] = a


if __name__ == '__main__':
    main()