#include<bits/stdc++.h>
using namespace std;
int main(){
int lim61 = 1000; //直接訂一個有點誇張的值,確保需要時會改變又不混淆
int lim59 = -1000;
int n;
cin >> n; //輸入數據數量
int a[n];
for(int i=0; i<n; i++){
int m;
cin >> m;
a[i] = m;
if(m < lim61 && m >= 60) { //比較數字大小,是否要替換原本的數值
lim61 = m;
} else if(m > lim59 && m < 60) {
lim59 = m;
}
}
sort(a, a+n); //排序
if(lim61 == 1000){
for(int i=0; i<n; i++){
cout << a[i];
if(i != n-1) { //因題目要求最後一數字後無空格
cout << " ";
}
}
cout << endl;
cout << lim59 << endl << "worst case" << endl;
}
else if(lim59 == -1000){
for(int i=0; i<n; i++){
cout << a[i];
if(i != n-1) {
cout << " ";
}
}
cout << endl;
cout << "best case" << endl << lim61 << endl;
}
else{
for(int i=0; i<n; i++){
cout << a[i];
if(i != n-1) {
cout << " ";
}
}
cout << endl;
cout << lim59 << endl << lim61 << endl;
}
return 0;
}