#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int a[110],n;
struct cmp
{
    bool operator()(int l,int r)
    {
        return abs(l)>abs(r);
    }
};
int main()
{
    while(scanf("%d",&n),n)
    {
        for(int i=0; i<n; i++)
            scanf("%d",a+i);
        sort(a,a+n,cmp());
        for(int i=0; i<n-1; i++)
            printf("%d ",a[i]);
        printf("%d\n",a[n-1]);
    }
    return 0;
}
