Let $A_i , A_2, A$ be left $\mathrm{R} -$ modules. If in the diagram below $$A_1 \rightleftarrows_{\pi_{1}}^{i_1} A \leftrightarrows_{\pi_{2}}^{i_2} A_2$$ we have that $\pi_1 i_1 = 1_{A_1}$ and $\pi_2 i_2 = 1_{A_2}$ and $(i_1, \pi_2)$ is exact (which means $im i_1 = ker \pi_2$) prove that $A \cong A_1 \oplus A_2$.
Does anyone have any idea how to solve this? I tried using the fact that $A$ satisfies the universal property of direct sums but didn't get anywhere.