if __name__ == '__main__':
    n = int(input())
    a_list = []
    for i in range(n):
        a = int(input())
        a_list.append(a)

    for i in range(n):
        cp = a_list.copy()
        del cp[i]
        print(max(cp))