public class Hanoi {
/**
* Hanoi
*/
public static void main(String[] args) {
try {
Scanner s = new Scanner(System.in);
System.out.print(" n=");
int n = s.nextInt();
System.out.println(" :");
hanoi(n, 'a', 'b', 'c');
// String n;
// InputStreamReader isr=new InputStreamReader(System.in);
// BufferedReader br=new BufferedReader(isr);
// System.out.print(" n=");
// n=br.readLine();
// hanoi(Integer.parseInt(n),'a','b','c');
} catch (Exception e) {
e.printStackTrace();
}
}
public static void hanoi(int n, char a, char b, char c) {
if (n == 1) {
//
System.out.println("Move Disc No:" + n + " from pile " + a + " to "
+ b);
} else {
// a n-1 b c
hanoi(n - 1, a, c, b);
// a b
System.out.println("Move Disc No:" + n + " from pile " + a + " to "
+ b);
// c n-1 a b
hanoi(n - 1, c, b, a);
}
}
}