Let $R$, $R'$ be commutative rings with multiplicative subsets $S, S'$ and the corresponding ring homomorphisms $\phi, \phi'$ into their respective ring of fractions.
Prove that for any ring homomorphism $f : R \rightarrow R',$ which maps $S$ into $S'$, there exists a unique ring homomorphism $\tilde{f} : S^{-1}R \rightarrow S'^{-1}R'$ such that $\tilde{f} \circ \phi = \phi' \circ f.$
\begin{array}{cc}
R & \xrightarrow{f} & R' \\
\downarrow{\phi} & & \downarrow{\phi'} \\
S^{-1} R & \xrightarrow{\tilde{f}}
& S'^{-1} R'
\end{array}
Also describe the image and the kernel of $\tilde{f}$ in terms relative to $f$.
Idea: I want to show this using the the universal property of the ring of quotients $S^{-1} R$, I am just not sure how to put all the pieces together. Any help/hints would be appreciated!