#include <iostream>
#include <algorithm>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(void)
{
int a,b,c,A[a];
cin >> a;
b=-1,c=-1;
for(int i=0;i<a;i++)
cin >> A[i];
{
sort(A,A+a);
for(int i=0;i<a;i++)
if(A[i]<60) b=A[i];
}
{
for(int i=a-1;i>=0;i--)
if(A[i]>=60) c=A[i];
}
{
cout << A[0];
for(int i=1;i<a;i++)
{
cout << " " <<A[i];
}
}
{
cout << endl;
if(b!=-1) cout << b << endl;
else cout << "best case" << endl;
if(c!=-1) cout << c << endl;
else cout << "worst case" << endl;
}
return 0;
}