import java.util.*;

public class Solution {
    
    ArrayList<String> res = new ArrayList<>();

    public ArrayList<String> getSolution(int n) {
        // write code here
        process(n, "left", "mid", "right");
        return res;
    }

    public void process(int n, String x, String y, String z) {
        if (n == 1) {
            res.add("move from " + x + " to " + z);
        } else {
            process(n - 1, x, z, y);
            res.add("move from " + x + " to " + z);
            process(n - 1, y, x, z);
        }
    }
}