backward and forward chainings implemented