+function h(n,a,b,c){n--&&h(n,a,c,b)+h(n,b,a,c,o+=a,p+=c)}(readline(o=p=''),'A','B','C') print(o+'\n'+p)