Exclusive nonleptonic decays of bottom and charm baryons in a relativistic three-quark model: Evaluation of nonfactorizing diagrams