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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var swr = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(swr);
            var max = 0;
            var n = int.Parse(Console.ReadLine());
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < n; i++)
            {
                max = 0;
                for (int j = 0; j < n; j++)
                {
                    if (i != j)
                    {
                        if (max < a[j])
                        {
                            max = a[j];
                        }
                    }
                }
                Console.WriteLine(max);
            }
            Console.Out.Flush();
        }
    }
}