num = int(input())
scorelst = input().split()
scorelst = sorted(list(map(int,scorelst)))
min = 0
max = 100
SixtyUpCount = 0
SixtyDownCount = 0
for i in range(num):
print(scorelst[i] , end=' ')
for i in range(num):
if scorelst[i] < 60:
min = scorelst[i]
for i in range(num-1,0 ,-1):
if scorelst[i] >= 60:
max = scorelst[i]
for i in range(num):
if scorelst[i] >=60:
SixtyUpCount += 1
else:
SixtyDownCount += 1
if SixtyUpCount == num:
print('\nbest case')
print(max)
if SixtyDownCount == num:
print('\n' + str(min))
print('worst case')