#include
int main()
{
int a[100],b[100],i,n,j,temp;
while(scanf("%d",&n)!=EOF&&n)
{
for(i=0; i<=n-1; i++)
scanf("%d",&a[i]);
for(i=0; i<=n; i++)
{
if(a[i]>=0) b[i]=a[i];
else b[i]=-a[i];
}
for(i=0; i<=n-2; i++)
{
for(j=i+1; j<=n-1; j++)
if(b[j]>b[i])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
temp=b[j],b[j]=b[i],b[i]=temp;/*b数组也要跟着交换*/
}
}
for(i=0; i<=n-2; i++)
printf("%d ",a[i]);
printf("%d\n",a[n-1]);
}
return 0;
}