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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var A = new int[N];
            var B = new int[N];


            for (int i =0; i < N; i++)
            {
                A[i] = int.Parse(Console.ReadLine());
                B[i] = A[i];

            }

            for(int i = 0;i < N; i++)
            {
                A[i] = 0;
                Console.WriteLine(A.Max());
                A[i] = B[i];

            }

        }
    }
}
