using System;
using System.Linq;
class Program {
    static void Main (string[] args) {
        // 整数の入力
        int N = int.Parse (Console.ReadLine ());
        int[] numbers = new int[N];
        for(int i = 0; i < N; i++){
            numbers[i] = int.Parse (Console.ReadLine ());
        }
        for(int i = 0; i < N; i++){
            int tmp = numbers[i];
            numbers[i] = 0;
            Console.WriteLine (numbers.Max());
            numbers[i] = tmp;
        }
    }
}