Here is how I did it. First write $f\circ g$ as a product of disjoint cycles. So here $f\circ g=(1\, 10)(2\,4\,7)(3\,5\,8\,6\,9)$. Now
$$\begin{align}
g\circ f &=f\circ(f\circ g)\circ f \\
&=f\circ(f\circ g)\circ f^{-1} \\
&=(f(1)\,f(10))(f(2)\, f(4)\,f(7))(f(3)\,f(5),f(8)\,f(6)\,f(9)).
\end{align}$$
On the other hand $(f\circ g)^{-1}=g^{-1}\circ f^{-1}=g\circ f$. So from the provided $f\circ g$ we can invert it to get $g\circ f$ which is $$(1\,10)(2\,7\,4)(3\,9\,6\,8\,5)$$
Therefore $$(f(1)\,f(10))(f(2)\, f(4)\,f(7))(f(3)\,f(5),f(8)\,f(6)\,f(9))=(1\,10)(2\,7\,4)(3\,9\,6\,8\,5)$$ and we can define $f$ to satisfy this (notice $f$ is not unique). After this you can find your $g$.