using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class CExceptionHandling
    {
        static void Main(string[] args)
        {            
            var n = int.Parse(Console.ReadLine());
            var aList = new List<int>();
            for (int i = 0; i < n; i++)
            {
                aList.Add(int.Parse(Console.ReadLine()));
            }

            List<int> copyList;
            for (int i = 0; i < n; i++)
            {
                copyList = new List<int>(aList);
                copyList.RemoveAt(i);
                Console.WriteLine(copyList.Max());
            }
            
            Console.ReadLine();
        }
    }
}