#include <bits/stdc++.h>
using namespace std;
int main(){
int a,num=0;
cin>>a;
vector<int>v;
for(int i=0;i<a;++i){
int temp;
cin>>temp;
v.push_back(temp);
}
sort(v.begin(),v.end());
for(int i=0;i<a;++i){
cout <<v[i]<<" ";
}
cout <<endl;
v.push_back(60);
sort(v.begin(),v.end());
for(int i=0;i<a+i;++i){
if(v[a]==60&&v[a-1]!=60){
cout <<v[a-1]<<endl;
cout << "worst case";
break;
}
else if(v[0]==60){
cout <<"best case"<<endl;
cout <<v[1];
break;
}
else{
for(int i=0;i<a+i;++i){
num++;
if(v[i]==60){
break;
}
}
cout <<v[num-2]<<endl;
cout <<v[num];
break;
}
}
}