import sys
import os
import copy


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    A = [int(sys.stdin.readline().rstrip()) for _ in range(N)]

    for n in range(N):
        ary = copy.copy(A)
        ary.pop(n)
        print(max(ary))


if __name__ == '__main__':
    main()
