import java.util.Arrays;
public class Sort {
public static void main(String[] args) {
int a[] = { 4, 5, 6, 3, 2, 5, 7, 9, 3 };
Arrays.sort(a);
if (a.length % 2 == 0) {
int b[] = new int[a.length / 2];
int c[] = new int[a.length / 2];
for (int i = 0; i < b.length; i++) {
b[i] = a[i];
}
for (int i = c.length; i < a.length; i++) {
c[i - c.length] = a[i];
}
for (int i = 0; i < a.length; i++) {
if (i % 2 == 0) {
a[i] = c[c.length - i / 2 - 1];
} else {
a[i] = b[i / 2];
}
}
} else {
int b[] = new int[a.length / 2];
int c[] = new int[a.length / 2 + 1];
for (int i = 0; i < b.length; i++) {
b[i] = a[i];
}
for (int i = b.length; i < a.length; i++) {
c[i - b.length] = a[i];
}
for (int i = 0; i < a.length; i++) {
if (i % 2 == 0) {
a[i] = c[c.length - i / 2 - 1];
} else {
a[i] = b[i / 2];
}
}
}
for (int i = 0; i < a.length; i++) {
System.out.print(a[i] + " ");
}
}
}