#include <bits/stdc++.h>
using namespace std;

void Print_permutation(string question, string answer){
    if (question.length() == 0)
    {
        /* code */
        cout<<answer<<endl;
        return ;
    }
    for(int i = 0; i < question.length(); i++)
    {
        char ch = question.at(i);
        string question_left_part = question.substr(0, i);
        string question_right_part = question.substr(i + 1);
        string rest_of_string = question_left_part + question_right_part;
        Print_permutation(rest_of_string, answer + ch);
    }
}
int main(){
    string str;
    cin>>str;
    Print_permutation(str, "");
    return 0;
}