#include <stdio.h>
#define MAXN 100

typedef unsigned int node;
int main()
{
    int n = 0;
    int i, j, p;
    
    node k[MAXN];
    node b[10][MAXN + 1];
    node m = 0, e = 1;
    
    while(n < 1 || n > MAXN) scanf("%d", &n);
    for(i = 0; i < n; i++, m = (m < k[i] ? k[i] : m)) scanf("%d", &k[i]);
    
    for(; m > 0 ; e *= 10, m /= 10)
    {
        for(i = 0; i < 10; i++) b[i][0] = 1;
        for(i = 0; i < n; i++) b[(k[i] / e) % 10][b[(k[i] / e) % 10][0]++] = k[i];
        for(p = i = 0; i < 10; i++) for(j = 1; j < b[i][0]; j++) k[p++] = b[i][j];
    }
    
    for(i = 0; i < n; i++) printf("%d ", k[i]);
}