using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(){
        
        int n = int.Parse(Console.ReadLine());
        int[] seq = new int[n]; 
        
        for(int i=0; i<n; i++){
            seq[i] = int.Parse(Console.ReadLine());
        }
        
        for(int j=0; j<n; j++){
            int otb = seq[j];
            seq[j] = 0;
            Console.WriteLine(seq.Max());
            seq[j] = otb;
        }
    }
}