Showing a function is invertible I came across this problem and not sure how to prove it.

Show that if $ f\circ f \circ g\circ g \circ f\circ f $ is invertible then $ g $ is invertible.

I'm not sure if it's correct to say that  $f$ is invertible because it's the most left function and then show that $g$ is invertible.

*

*1) $r$ is by definition a retraction if $r\circ s=\text{id}$ for some
$s$.

*2) $s$ is by definition a section if $r\circ s=\text{id}$ for some
$r$.

*3) If $h$ is both a retraction and a section then $h$ is invertible:
let $h\circ s$ and $r\circ h$ be identities. Then $r=r\circ h\circ s=s$
showing that $r=s$ serves as inverse of $h$.

*4) If $r\circ s$ is invertible and $h$ is its inverse then $r\circ\left(s\circ h\right)=\text{id}$
and $\left(h\circ r\right)\circ s=\text{id}$ showing that $r$ is
a retraction and $s$ is a section.
The fact that $f\circ (f \circ g\circ g \circ f\circ f)$ is invertible implies that $f$ is a retraction (by 4).
The fact that $(f\circ f \circ g\circ g \circ f)\circ f$ is invertible implies that $f$ is a section (by 4).
Then $g\circ g=f^{-1}\circ f^{-1}\circ f\circ f\circ g\circ g\circ f\circ f^{-1}\circ f^{-1}$ is invertible (by 3) hence $g$ is a retraction and a section (by 4). 
Then $g$ is invertible (by 3).
