#include <cstdio>
#include <algorithm>
using namespace std;
int a[110];
int main()
{
    int n;
    while(scanf("%d",&n),n)
    {
        for(int i=0;i<n;i++)
            scanf("%d",a+i);
        iter_swap(a,min_element(a,a+n));
        for(int i=0; i<n-1; i++)
            printf("%d ",a[i]);
        printf("%d\n",a[n-1]);
    }
    return 0;
}
