Prove that in the diagram $A_1 \rightleftarrows_{i_{1}}^{\pi_1} A \leftrightarrows_{i_{2}}^{\pi_2}$ we have $A \cong A_1 \oplus A_2$ 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.

Since $R$-mod is an abelian category, $i_1$ is injective, and $\pi_2$ is surjective, you can use the splitting lemma on the short exact sequence
$$
0\rightarrow A_1\xrightarrow{i_1}A\xrightarrow{\pi_2} A_2\rightarrow 0.
$$
The arrow $i_2$ is gives a right splitting (and $\pi_1$ gives a left splitting, and having either one of them is enough.) 
