using System;
using System.Collections.Generic;

namespace Atcoder_program_test_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int N,A, Temporary_out,Temporary_A;
            int counter;
            int str_counter = 1;
            int i;
            N = int.Parse(Console.ReadLine());
            List<string> str = new List<string>();
            Temporary_out = N - 1;
            for (counter = 0;N > counter;counter++)
            {
                str.Add(Console.ReadLine());
            }


            for (i = 0;i < N; i++)
            {
                Temporary_out = 0;
                for (A = 0; A < N; A++)
                {
                    Temporary_A = int.Parse(str[A]);
                    if (i == A) { }
                    else
                    {
                        if (Temporary_out < Temporary_A)
                        {
                            Temporary_out = Temporary_A;
                        }
                    }
                }
                Console.WriteLine(Temporary_out);
                str_counter = 1;
            }
            Console.ReadKey();
        }
    }
}