Let $R$ be a ring, $\mathbb{Q}$ be the field of rational numbers, and $f,g: R \to \mathbb{Q}$ be homomorphisms such that $f(n)=g(n)$ for all $n\in \mathbb{Z}$, where $\mathbb{Z}$ is the ring of integers, show that $f=g$.
(Hint: first show $f(1/n)= g(1/n)$ for all $n \in \mathbb{Z}$)