#36496: 簡單寫APCS


ozasd6565@gmail.com (Z O)


n = input()
score = input()

score = score.split(' ')
score = [int(i) for i in score]
bestcase = []
worstcase = []
for i in score:
    if i >= 60:
        bestcase.append(i)
    elif i < 60:
        worstcase.append(i)
        
score.sort()
print(*score)bestcase.sort()
worstcase.sort()

if len(bestcase) == 0:
    print(worstcase[-1])
    print('worst case')

elif len(worstcase) == 0:
    print('best case')
    print(bestcase[0])  
    
elif len(bestcase) != 0 and  len(worstcase) != 0:
    print(worstcase[-1])
    print(bestcase[0])