#include<iostream>
#include <vector>
#include <algorithm>

int main(){
    std::vector<int> v;
    int x;
    do {
        std::cin>>x;
        if (!x) break; // IT WASN'T HERE!!!
        v.push_back(x);
    } while (x);

    int c = 0;
    bool s = false;
    do {
        std::rotate(v.begin(),v.begin()+1,v.end());
        c++;
        if (std::is_sorted(v.begin(),v.end())){
            s = true;
        }
    } while(!s && (c <= v.size()));

    if (s){
        for(int y = 0; y <= v.size(); y++){
            std::cout<<v[y]<<" ";
        }
    }
    else {
        std::cout<<"False";
    }
    return 0;
}
