output_description: Print N lines. The i-th line (1 \leq i \leq N) should contain the maximum
  value among the N-1 elements other than A_i in the sequence.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1
      :
      A_N
attempt: import glob
  import numpy as np
  import collections
  
  
  # 問題ごとのディレクトリのトップからの相対パス
  REL_PATH = "ABC\\134\\C"
  
  # テスト用ファイル置き場のトップ
  TOP_PATH = "C:\\AtCoder"
  
  
  class Common:
  
      problem = []
      index = 0
  
      def __init__(self, rel_path):
          self.rel_path = rel_path
  
      def initialize(self, path):
          file = open(path)
          self.problem = file.readlines()
          self.index = 0
          return
  
      def input_data(self):
          try:
              IS_TEST
              self.index += 1
              return self.problem[self.index - 1]
  
          except NameError:
              return input()
  
      def resolve(self):
          pass
  
      def exec_resolve(self):
          try:
              IS_TEST
              for path in glob.glob(TOP_PATH + "\\" + self.rel_path + "/*.txt"):
                  print("Test: " + path)
                  self.initialize(path)
                  self.resolve()
                  print("\n\n")
          except NameError:
              self.resolve()
  
  
  class C(Common):
  
      def resolve(self):
  
          seq_len = int(self.input_data())
          seq = np.array([0 for i in range(seq_len)])
          for i in range(seq_len):
              seq[i] = int(self.input_data())
  
          max_num = np.max(seq)
          times = collections.Counter(seq)[max_num]
  
          if times >= 2:
              for i in range(seq_len):
                  print(str(seq[i]))
          else:
              for i in range(seq_len):
                  if seq[i] != max_num:
                      print(str(max_num))
                  else:
                      print(
                          np.max(seq[0:i])
                          if np.max(seq[0:i]) > np.max(seq[i + 1 : seq_len])
                          else np.max(seq[i + 1 : seq_len])
                      )
  
  
  solver = C(REL_PATH)
  solver.exec_resolve()
  
problem_description: Statement
  
  You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i
  between 1 and N (inclusive), answer the following question:
  
    * Find the maximum value among the N-1 elements other than A_i in the sequence.
samples: [{"input": "3\n    1\n    4\n    3", "output": "4\n    3\n    4\n    \n\n  * The maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n  * The maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n  * The maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\n* * *"}, {"input": "2\n    5\n    5", "output": "5\n    5"}]