#include <iostream>
#include <cstring>
//請勿抄襲
//擁有自己的想法很重要喔
using namespace std;
int main()
{
int people, hi, lo;
int grade_record[101], grade;
while(cin >> people){
hi = -1, lo = 101;
memset(grade_record, 0, sizeof(grade_record));
for(int i = 0; i<people; i++){
cin >> grade;
if(grade < 60 && grade > hi)
hi = grade;
else if(grade >= 60 && grade < lo)
lo = grade;
grade_record[grade]++;
}
int i;
/* quite boring*/
for(i = 0; i<=100; i++)
if(grade_record[i]){
cout << i;
grade_record[i]--;
break;
}
for(i = 0; i<=100; i++)
while(grade_record[i]--)
cout << " " << i;
cout << endl;
if(hi != -1)
cout << hi << endl;
else
cout << "best case\n";
if(lo != 101)
cout << lo << endl;
else
cout << "worst case\n";
}
}