#include <bits/stdc++.h>
using namespace std;
int main()
{int N,A,B[20]={0},best,bad,MX=0,MN=0;
cin>>N;
deque<int> ans,luck;
for(int i=0;i<N;i++){
cin>>B[i];
}
sort(B,B+N);
for(int i=0;i<N;i++){
if(i!=N-1)cout<<B[i]<<" ";
else cout<<B[i];
}
for(int i=0;i<N;i++){
if(B[i]>=60){
MX++;
luck.push_back(B[i]);
sort(luck.begin(),luck.end());
best=luck.front();
}
else if(B[i]<60){
MN++;
ans.push_back(B[i]);
sort(ans.begin(),ans.end());
bad=ans.back();
}
}
if((MX==0)&&(MN>0)){
cout<<endl<<bad<<endl<<"worst case";
}
else if((MN==0)&&(MX>0)){
cout<<endl<<best<<endl<<"best case";
}
else if((MN>0)&&(MX>0))cout<<endl<<bad<<endl<<best;
return 0;
}