Forward Chaining Algorithm Python