#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main(void){
int i,a[1000],j,temp,count=0,n,b;
cin>>n;
for(i=0; i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
for(j=i-1,b=i;j>=0;j--,b--)
if(a[j]>a[b]){
temp=a[j];
a[j]=a[b];
a[b]=temp;
}
for(i=0;i<n;i++){
cout<<a[i];
if(i<n-1)
cout<<" ";}
cout<<endl;
for(i=n-1;i>=0;i--){
if(a[i]<60)
count++;
if(count==1){
cout<<a[i]<<endl;
break;}}
if(count==0)
cout<<"best case"<<endl;
for(i=0,count=0;i<n;i++){
if(a[i]>=60)
count++;
if(count==1){
cout<<a[i]<<endl;
return 0;}}
if(count==0)
cout<<"worst case"<<endl;
return 0;}