using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        int tmp;
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
        }
        for (int i = 0; i < n; i++)
        {
            tmp = a[i];
            a[i] = -1;
            Console.WriteLine(a.Max());
            a[i] = tmp;
        }
    }
}