//递归的方法
class Solution {
public:
    void hanno(int n,vector<string> &ans,string from,string to,string other ){
        if(n==1){
            string ansi="move from "+from+" to "+to;
            ans.push_back(ansi);
        }      
        else{
            hanno(n-1,ans,from,other,to);
            string ansi="move from "+from+" to "+to;
            ans.push_back(ansi);
            hanno(n-1,ans,other,to,from);
        }
    }
    vector<string> getSolution(int n) {
        string from="left";
        string to="right";
        string other="mid";
        vector<string> ans;
        hanno(n,ans,from,to,other);
        return ans;
    }
};