x = int(input())
y = list(map(int,input().split()))
y = sorted(y)
ans2=[]
ans3 = []
print(*y)
for i in y:
if i < 60:
ans2.append(i)
if i >= 60:
ans3.append(i)
if len(ans2) == 0:
print('best case')
else:
print(ans2[-1])
if len(ans3) == 0:
print('worst case')
else:
print(ans3[0])