#include <fstream>
#include <algorithm>
#include <cstring>
using namespace std;
ifstream f("permrep.in");
ofstream g("permrep.out");
char c[10];
int main()
{
f>>c;
sort(c,c+strlen(c));
do
{
g<<c<<'\n';
}
while(next_permutation(c,c+strlen(c)));
return 0;
}