#include<iostream>
#include <algorithm>
using namespace std;
int students, score;
int a,i,n;
int main(){
while(1){
int students;
int a,i,n;
cin>>students;
n=students;
int iarr[n];
for(i=0;i<n;i++){
cin>>iarr[i];
}
sort(iarr,iarr+n);
for(a=0;a<n;a++){
cout<<iarr[a]<<" ";
}
cout<<"\n";
int minPass = -1;
for (int i = 0; i < n; i++)
{
if (iarr[i] >= 60)
{
minPass = iarr[i];
break;
}
}
int maxNoPass = -1;
for (int i = n - 1; i >= 0; i--)
{
if (iarr[i] < 60)
{
maxNoPass = iarr[i];
break;
}
}
if (maxNoPass == -1)
{
cout<<"best case\n";
}
else
{
cout<< maxNoPass<<"\n";
}
if (minPass == -1)
{
cout<<"worst case\n";
}
else
{
cout<<minPass<<"\n";
}
}
}