#!/usr/bin/env python3


def main():
    N = int(input())
    As = [int(input()) for _ in range(N)]
    for i in range(N):
        tmp = As[:]
        tmp.pop(i)
        print(max(tmp))


if __name__ == '__main__':
    main()
