import java.util.Scanner;
import java.lang.Math;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int n = in.nextInt();
if(n==0)
break;
int[] a = new int[n];
int index = 0, tmp;
for (int i = 0; i < n; i++)
a[i] = in.nextInt();
if (n == 1)
System.out.println(a[0]);
else
for (int i = 1; i < n; i++)
if (a[index] > a[i])
index = i;
tmp = a[index];
a[index] = a[0];
a[0] = tmp;
for (int i=0;i<n;i++) {
System.out.print(a[i]);
if(i!=n-1)
System.out.print(" ");
}
System.out.println();
}
}
}