using System;
using System.Linq;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = int.Parse(Console.ReadLine());
    }
    for (int i = 0; i < N; i++) {
      int n = arr[i];
      arr[i] = int.MinValue;
      Console.WriteLine(arr.Max());
      arr[i] = n;
    }
  }
}