from sys import stdin

readline = stdin.readline


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


def main():
    n, *al = nf()
    for i in range(n):
        ma = 1
        for j, a in enumerate(al):
            if j == i:
                continue
            ma = max(ma, a)
        print(ma)


if __name__ == "__main__":
    main()
