Supporting following case

A(A,B)
3
B(x,ABC)&C(x,CDE)=>A(A,B)
D(x,ABC)=>B(DEF,ABC)
D(DEF,ABC)
C(DEF,CDE)