p = int(input())
list1 = input()
list2 = list1 # 保留原始輸入
list1 = list(map(int, list1.split())) # 轉換為整數列表
h, l, x, y = 101, 0, 0, 0
for score in list1:
if score > 59 and score < h:
h = score
elif score < 60 and score > l:
l = score
if score > 59:
x += 1
elif score < 60:
y += 1
# 將 list2 轉換為數字列表並排序
list2 = list(map(int, list2.split()))
list2.sort() # 由小到大排序
print(*list2) # 輸出排序後的 list2
if x == len(list1):
print("best case")
print(h)
elif y == len(list1):
print(l)
print("worst case")
else:
print(l)
print(h)