#include <iostream>
using namespace std;
int main(){
int v[100],n,i;
cin >> n;
for(i=0;i<n;i++) cin >> v[i];
//Bubble sort
int ok=1;
while(ok){
ok=0;
for(i=0;i<n-1;i++){
if(v[i]%10>v[i+1]%10){
swap(v[i],v[i+1]);
ok=1;
}
}
//Afisare rezultat
for(i=0;i<n;i++) cout << v[i] << " ";
}