using System;
using System.Linq;

namespace ABC134
{
    class C
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(Console.ReadLine());
            }

            int[] Ans = new int[N];
            int tmp = 0;
            for (int i = 0; i < N; i++)
            {
                tmp = A[i];
                A[i] = 0;
                Ans[i] = A.Max();
                A[i] = tmp;
            }

            foreach (int a in Ans)
            {
                Console.WriteLine(a);
            }
        }
    }
}