#28624: python


jeter.nice@gmail.com (唯一)


def fail_high(score):
    high = [i for i in score if i <60]
    return 'best case' if len(high) == 0 else max(high)
def fail_low(score):
    low = [i for i in score if i >=60]
    return 'worst case' if len(low) == 0 else min(low)
input()
score = [int(i) for i in input().split()]
score.sort()
print(" ".join([str(i) for i in score]))
print(fail_high(score))
print(fail_low(score))