Buggy python submission (verdict: Time Limit Exceeded):
data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max(data[0:n]+data[n+1:]))

Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Time Limit Exceeded):
data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max(data[0:n]+data[n+1:]))

Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Time Limit Exceeded):
data = []

data = [int(input()) for _n in range(int(input()))]

for n in range(len(data)):
	print(max(data[0:n]+data[n+1:]))


Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Runtime Error):
data = []
res = []

data = [int(input()) for _n in range(int(input()))]

for n in range(i):
	res.append(max(data[0:n]+data[n+1:]))

for item in res:
	print(item)



Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Time Limit Exceeded):
data = []
res = []
i = int(input())

for _n in range(i):
	data.append(int(input()))

for n in range(i):
	res.append(max(data[0:n]+data[n+1:]))

for item in res:
	print(item)



Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Time Limit Exceeded):
data = []

i = input()

for n in range(int(i)):
	data.append(int(input()))

for i in range(len(data)):
	print(max(data[0:i]+data[i+1:]))

Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Buggy python submission (verdict: Time Limit Exceeded):
data = []

def maxsearchex(n):
	maxInt = 0
	for i in range(len(data)):
		if i != n:
			if maxInt < data[i]:
				maxInt = data[i]
	print(maxInt)

i = input()

for n in range(int(i)):
	data.append(int(input()))

for i in range(len(data)):
	maxsearchex(i)



Fixed submission:
import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)