import java.util.*;


public class Solution {
   
   
    public ArrayList<String> getSolution (int n) {
        // write code here
        ArrayList<String> ret = new ArrayList<>();
       
        String left ="left",mid = "mid",right="right";
        dfs(n,left,mid,right,ret);

        return ret;
    }
    //递归  :String 对应的是出发;借助:目的的
    public void dfs(int n, String left, String mid,String right,List<String> list){
        String s ;
        //直接移动
        if(n==1){
            s = "move from " +left +" to "+right;
            //将此次操作记录
            list.add(s);
            //直接返回 函数出口
            return;
        }
        //不为1,先以动n-1个,从left借助right到mid;
        dfs(n-1,left,right,mid,list);

        //然后将最大一个移动到right;
         s = "move from "+left+" to "+right;
         list.add(s);
         //最后将mid上的借助left移动到rigft上
         dfs(n-1,mid,left,right,list);
    }
}