Two-dimensional lattice Monte Carlo simulation of the compatibility of A/B/functionalized A ternary polymer mixtures coupled with chemical reaction