import java.util.*;
public class Main {
public static void main(String[] args) {
hanio(3, 'A', 'C', 'B');
}
static void hanio(int n, char from, char to, char via) {
if (n == 1) {
System.out.printf("%c -> %c\n", from, to);
return;
}
hanio(n - 1, from, via, to);
hanio(1, from, to, via);
hanio(n - 1, via, to, from);
}
}
class Solution {
public void hanota(List<Integer> A, List<Integer> B, List<Integer> C) {
move(A.size(),A,B,C);
}
public static void move(int n,List A,List B,List C) {
if (n == 1) {
C.add(A.remove(A.size() - 1));
return;
}else {
move(n - 1,A,C,B);
C.add(A.remove(A.size() - 1));
move(n - 1,B,A,C);
}
}
}