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