using System;

class Program
{
    static void Main(string[] args) {
        String ret;
        ret = process(new System.IO.StreamReader(Console.OpenStandardInput()));
        //ret = process("20 4");

        //Console.WriteLine(ret);
        //Console.ReadLine();
    }

    static string process(System.IO.TextReader input) {
        int n   = int.Parse(input.ReadLine());
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = int.Parse(input.ReadLine());
        }

        for(int i=0; i<n; i++) {
            int max = 0;
            for(int j=0; j<n; j++) {
                if (i != j && a[j] > max) max = a[j];
            }
            Console.WriteLine(max);
        }
        return null;
    }

    static string process(string input) {
        return process(new System.IO.StringReader(input));
    }
}