#include<iostream>
using namespace std;

int main()
{
    string s;
    cin>>s;
    s[3] = s[0];
    s[0] = s[1];
    s[1] = s[2];
    s[2] = s[3];
    cout<<s<<"\n";
}
#include <bits/stdc++.h>
using namespace std;

vector<long long> divisor(long long N) {
    //dが約数ならN/dも約数で、計算量は√N
    vector<long long> ret1, ret2;
    for (long long i=1; i*i<=N; i++)
    {
        if (N%i==0) {
            ret1.push_back(i);
            if (i*i != N) ret2.push_back(N/i);
        }
    }
    reverse(ret2.begin(), ret2.end());
    //反転してから結合
    for (long long i:ret2) ret1.push_back(i);
    return ret1;
}

int main() {
    long long N;
    cin >> N;
    //dが約数ならN/dも約数で、計算量は√N
    vector<long long> ret;
    ret = divisor(N);
    for (long long i:ret) cout << i << endl;
}