using System;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = int.Parse(Console.ReadLine());
           int[] array = new int[count];
            for (int i = 0; i < count; i++)
                array[i] = int.Parse(Console.ReadLine());
            int max = 0;
            for (int i = 0; i < count; i++)
            {
                max = 0;
                for (int j = 0; j < count; j++)
                {
                    if (j == i)
                       continue;
                  max = Math.Max(array[j], max);
                }
                Console.WriteLine(max);
            }
        }
    }
}
