o='\n' h={n,a,b,c->n--&&[h(n,a,c,b),print(a),o+=c,h(n,b,a,c)]} h(System.in.read()%8,'A','B','C') print o