#include <stdio.h>
int main (void){
int n;
scanf ("%d", &n);
int sorces[n];
int i, j, M=-1, m=101, tmp; //M<60, m>60
for (i=0; i<n; i++){
scanf ("%d", &sorces[i]);
if (sorces[i]<60 && sorces[i]>M)
M=sorces[i];
if (sorces[i]>=60 && sorces[i]<m)
m=sorces[i];
}
for (i=n-1; i>0; i--){
for (j=0; j<i; j++){
if (sorces[j]>sorces[j+1]){
tmp=sorces[j];
sorces[j]=sorces[j+1];
sorces[j+1]=tmp;
}
}
}
for (i=0; i<n; i++){
if (i!=n-1)
printf ("%d ", sorces[i]);
else printf ("%d\n", sorces[i]);
}
if (M==-1)
printf ("best case\n");
else printf ("%d\n", M);
if (m==101) //輸出第3行+"\n"下一行(第4行空行)
printf ("worst case\n");
else printf ("%d\n", m);
}