#include < iostream >
using namespace std;
signed main(){
int i;
cin >> i;
cout << i / 1000000 << " km ";
i %= 1000000;
cout << i / 1000 << " m ";
i %= 1000;
cout << i / 10 << " cm ";
i %= 10;
cout << i << " mm";
}
i = int(input())
print(f'{i//1000000} км {i//1000%100} м {i//10%100} см {i%10} мм')
#include < iostream >
using namespace std;
signed main(){
int i;
cin >> i;
cout << i / 1000000 << " km ";
i %= 1000000;
cout << i / 1000 << " m ";
i %= 1000;
cout << i / 10 << " cm ";
i %= 10;
cout << i << " mm";
}
i = int(input())
print(f'{i//1000000} км {i//1000%100} м {i//10%100} см {i%10} мм')