T='\n' (h={n,f,t,v->n--&&[h(n,f,v,t),print(f),T+=t,h(n,v,t,f)]})System.in.read()%8,'A','C','B' print T