#include <iostream>
#include <stack>
int main()
{
for (int i = 1345; i <= 1349; ++i)
{
int t = i;
std::stack<int> st;
do
{
st.push(t % 10);
}
while (t /= 10);
while (!st.empty())
{
std::cout << st.top() << " ";
st.pop();
}
}
std::cout << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RhY2s+CgppbnQgbWFpbigpCnsKICAgIGZvciAoaW50IGkgPSAxMzQ1OyBpIDw9IDEzNDk7ICsraSkKICAgIHsKICAgICAgICBpbnQgdCA9IGk7CiAgICAgICAgc3RkOjpzdGFjazxpbnQ+IHN0OwogICAgICAgIGRvCiAgICAgICAgewogICAgICAgICAgICBzdC5wdXNoKHQgJSAxMCk7CiAgICAgICAgfSAKICAgICAgICB3aGlsZSAodCAvPSAxMCk7CiAgICAgICAgCiAgICAgICAgd2hpbGUgKCFzdC5lbXB0eSgpKQogICAgICAgIHsKICAgICAgICAgICAgc3RkOjpjb3V0IDw8IHN0LnRvcCgpIDw8ICIgIjsKICAgICAgICAgICAgc3QucG9wKCk7CiAgICAgICAgfQogICAgfQogICAgc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKfQ==