Suppose that we have 2 objects in a category, $G$ and $F$.Suppose further that $f: F \to M$ a $g: G \to M$ and $h: G \to F$ and $k: F \to G$ such that $f\circ h = g$ a $g\circ k = f$. From this it follows that $f\circ h\circ k = g\circ k = f$. Finaly suppose that $h\circ k$ is an automorphism of $F$ and also $k\circ h$ is automorfism of $G$.
Now I want to show that $F\cong G$ by exhibiting $h':G\to F$ and $k':F\to G$ with $h'\circ k'=id_F$ and $k'\circ h'=id_G.$ What can I take by $h'$ and $k'$ ?
$M$ and the maps $f, g$ are red herrings — nothing stops $M$ being terminal, in which case $fh=g$ and $gk=f$ would always hold so you gain nothing from their existence.
Let $a = (hk)^{-1}$ and $b = (kh)^{-1}$, so $hka = 1_F = ahk$ and $khb = bkh = 1_G$. Then $h(ka) = 1_F$, so $h$ has a right inverse $ka$, and $(bk)h = 1_G$, so $h$ has a left inverse $bk$. They are equal by the usual argument ($bk = bk1_F = bk hk a = 1_Gka = ka$), so $h$ is an isomorphism $G \to F$ with inverse $bk=ka$.