Buggy python submission (verdict: Runtime Error):
n = int(input())
numList  = [input() for i in range(n)]
maxVal = max(numList)
workList = numList[:]
secondVal = max(workList.remove(maxVal))
for num in numList:
  if num != maxVal:
    print(maxVal)
  else
    print(secondVal)

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Runtime Error):
n = int(input())
# リスト内包表記
numList  = [input() for i in range(n)]

workList = numList.copy()
for j in range(n):
  workList.remove(numList[j])
  print(max(set(workList)))
  workList = numList.copy()

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
# リスト内包表記
numList  = [input() for i in range(n)]

workList = numList.copy()
for j in range(n):
  workList.remove(numList[j])
  print(max(set(workList)))
  workList = numList.copy()

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
numList = []
for i in range(n):
  numList.append(int(input()))

workList = numList.copy()
for j in range(n):
  workList.remove(numList[j])
  print(max(set(workList)))
  workList = numList.copy()

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
numList = []
for i in range(n):
  numList.append(int(input()))

workList = numList[:]
for j in range(n):
  workList.remove(numList[j])
  print(max(set(workList)))
  workList = numList.copy()

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
numList = []
for i in range(n):
  numList.append(int(input()))

workList = numList[:]
for j in range(n):
  workList.remove(numList[j])
  workSet = set(workList)
  print(max(workSet))
  workList = numList[:]

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
numList = []
for i in range(n):
  numList.append(int(input()))

workList = numList[:]
for j in range(n):
  workList.remove(numList[j])
  workSet = set(workList)
  print(max(workSet))
  workList = numList[:]

Fixed submission:
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)