The exercise is: Let $G$ be an abelian group containing a subset $X = \left\{ x_1 , \ldots , x_n \right\}$ and suppose for every abelian group $H$ and every function $\gamma : X \rightarrow H$ there exists a unique homomorphism $\tilde{\gamma} : G \rightarrow H $ such that $\tilde{\gamma} \left(x_j\right) = \gamma \left(x_j \right)$ for every $j$. Show that $G$ is free abelian of rank $n$.
Now, it should be sufficient to show that $X$ is the basis, but how would I go about doing this? I tried using $X$ to generate $\sum_{x \in X} \mathbb{Z}$, a direct sum, and finding an isomorphism back to $G$, but without success. I'm sure that $\tilde{\gamma} \left(x_j\right) = \gamma \left(x_j \right)$ is quite important, though I don't see how it fits into the puzzle at all.
Any help at all is much appreciated. Thank you.