x:"";y:x;f:fun(n,a,b,c){if(n>0){f(n-1,a,c,b);x~=a;y~=c;f(n-1,b,a,c);}}f(stdin.get_s(1).to_i,"A","B","C");x.p;y.p;