#include <iostream>
#include <cstring>
using namespace std;
const int N = 10;
int n; // n用于存放输入的字符串a的长度
char a[N], path[N]; // a[N]用于存放输入的字符串,path[N]用于存放每种排列之后的字符串
bool st[N];
void dfs(int u)
{
if(u == n)
{
for(int i = 0; i < n; i++)
{
cout << path[i];
}
cout << endl;
return;
}
for(int i = 0; i < n; i++)
{
if(!st[i])
{
path[u] = a[i];
st[i] = true;
dfs(u + 1);
// path[u] = 0;
st[i] = false;
}
}
}
int main()
{
cin >> a;
n = strlen(a);
dfs(0);
return 0;
}