Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	del nums[idx]
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = max(nums)
next_max = num_max

for idx, el in enumerate(nums):
	del nums[idx]
	if num_max == el:
		if next_max == num_max:
			next_max = max(nums)
			print(next_max)
		else:
			print(next_max)
		
	else:
		print(num_max)
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)

Buggy python submission (verdict: Runtime Error):


n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = max(nums)
next_max = num_max

for idx, el in enumerate(nums):
	del nums[idx]
	if num_max == el:
		if next_max == num_max
			next_max = max(nums)
			print(next_max)
		else:
			print(next_max)
		
	else:
		print(num_max)
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = max(nums)

for idx, el in enumerate(nums):
	del nums[idx]
	if num_max == el:
		print(max(nums))
	else:
		print(num_max)
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

for idx, el in enumerate(nums):
	del nums[idx]
	print(np.max(nums))
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)

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

for idx, el in enumerate(nums):
	del nums[idx]
	print(max(nums))
	nums.insert(idx, el)



Fixed submission:
import numpy as np

n =	int(input())
nums = [int(input()) for i in range(n)]

num_max = np.max(nums)
next_max = sorted(nums)[-2]


for idx, el in enumerate(nums):
	if num_max == el:
		print(next_max)		
	else:
		print(num_max)