from sys import stdin

readline = stdin.readline


def ns():
    """
    入力を`[\\s]`を除いて文字列として取得
    """
    return readline().rstrip()


def ni():
    """
    入力を`int`に変換
    """
    return int(ns())


def nf():
    """
    入力全て(EOFまで)を`int iter`に変換
    """
    return map(int, open(0).read().split())


def main():
    n = ni()
    a = list(nf())
    for i in range(n):
        tmp = a[:]
        tmp.pop(i)
        print(max(tmp))


if __name__ == "__main__":
    main()
