#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main() {
char anagrama[13];
cin>>anagrama;
int len = strlen(anagrama);
sort(anagrama, anagrama+len);
do {
cout << anagrama << endl;
} while (next_permutation(anagrama, anagrama+len));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGNoYXIgYW5hZ3JhbWFbMTNdOwoJY2luPj5hbmFncmFtYTsKaW50IGxlbiA9IHN0cmxlbihhbmFncmFtYSk7CnNvcnQoYW5hZ3JhbWEsIGFuYWdyYW1hK2xlbik7CmRvIHsKICAgIGNvdXQgPDwgYW5hZ3JhbWEgPDwgZW5kbDsKfSB3aGlsZSAobmV4dF9wZXJtdXRhdGlvbihhbmFncmFtYSwgYW5hZ3JhbWErbGVuKSk7CglyZXR1cm4gMDsKfQ==