#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
constexpr const char chs[] = "123";
constexpr unsigned n = sizeof chs - 1;
struct s3 { char s[3]; } all[n*n*n];
constexpr void build_all()
{
for (unsigned q=0, i=0; q<n; ++q)
for (unsigned w=0; w<n; ++w)
for (unsigned e=0; e<n; ++e, ++i)
{
all[i].s[0] = chs[q];
all[i].s[1] = chs[w];
all[i].s[2] = chs[e];
}
}
int main()
{
build_all();
random_shuffle(begin(all), end(all));
for (auto &x : all) printf("%.3s\n", x.s);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0ZXhwciBjb25zdCBjaGFyIGNoc1tdID0gIjEyMyI7CmNvbnN0ZXhwciB1bnNpZ25lZCBuID0gc2l6ZW9mIGNocyAtIDE7CgpzdHJ1Y3QgczMgeyBjaGFyIHNbM107IH0gYWxsW24qbipuXTsKCmNvbnN0ZXhwciB2b2lkIGJ1aWxkX2FsbCgpCnsKICBmb3IgKHVuc2lnbmVkIHE9MCwgaT0wOyBxPG47ICsrcSkKICAgIGZvciAodW5zaWduZWQgdz0wOyB3PG47ICsrdykKICAgICAgZm9yICh1bnNpZ25lZCBlPTA7IGU8bjsgKytlLCArK2kpCiAgICAgIHsKICAgICAgICBhbGxbaV0uc1swXSA9IGNoc1txXTsKICAgICAgICBhbGxbaV0uc1sxXSA9IGNoc1t3XTsKICAgICAgICBhbGxbaV0uc1syXSA9IGNoc1tlXTsKICAgICAgfQp9CgppbnQgbWFpbigpCnsKICBidWlsZF9hbGwoKTsKCiAgcmFuZG9tX3NodWZmbGUoYmVnaW4oYWxsKSwgZW5kKGFsbCkpOwogIGZvciAoYXV0byAmeCA6IGFsbCkgcHJpbnRmKCIlLjNzXG4iLCB4LnMpOwoKICByZXR1cm4gMDsKfQ==