Extend a function on a generating set to a homomorphism 
Suppose that $G=\langle S\mid R\rangle$ (where $S\subset G$ is a subset with a set of relations $R$) and that $\psi$ is a function $S\to H$ where $H$ is an arbirtrary group. Suppose further that each relation in $R$ becomes $1\in H$ if each $T\in S$ that appears in the relation is replaced by $\psi(T)$.
Show that $\psi$ can be extended to a homomorphism $G\to H$.

I have trouble understanding the concepts of relations. It is clear that the proof somehow follows from the universal property of free groups. But how exactly so? I know that $T_1^{\epsilon_1}\cdots T_k^{\epsilon_k}\in R$ maps to $\psi(T_1)^{\epsilon_1}\cdots \psi(T_k)^{\epsilon_k}=1\in H$, $\epsilon_i\in\{\pm 1\}$ but what can I derive from that other than information about the kernel as soon as I know it's a homomorphism?
I've also found this paragraph in my book:

If $G$ is an arbitrary group generated by a subset $S$, then there is a homomorphism $\phi$ from a free group $F$ of rank $|S|$ onto $G$, and so $G\cong F/\ker(\phi)$. In fact, $F$ may be chosen to be the free group based on the set $S$ itself. If an element $T\in S$ is denoted by $\hat T$ when it is considered as an element of the free group $F$ rather than as an element of $G$, then the homomorphism is the map that results from setting $\phi(\hat T)=T$ for all $\hat T\in S$.

I'm fairly sure everything I need can be found in there but how do I glue it together? Since $H$ was arbirtrary I can't treat it as the free group based on $S$.
 A: The definition of $\langle S\mid R\rangle$ is supposedly that $\langle S\mid R\rangle=F/N$ where $F$ is a free group over $S$ and $N$ is the intersection of all normal subgroups of $F$ containing $R$.
The definition of $F$ (strictly speaking, together with a map $i\colon S\to F$) is by a universal property: For every group $H$ and every map $f\colon S\to H$, there exists one and only one homomorphism $\phi\colon F\to H$ such that $\phi\circ i=f$.
The definition of $F/N$ (strictly speaking, together with a projection $\pi\colon F\to F/N$) is also via a universal property: For every group $H$ and homomorphism $\phi\colon F\to H$ with $\phi\restriction_N=0$, there exists one and only one homomorphism $\bar\phi\colon F/N\to H$ such that $\bar\phi\circ \pi=\phi$.
Now in your problem, we are given a map $\psi\colon S\to H$. As seen above, this extends in a unique fashion to a homomorphism $F\to H$. As "replacing every $T\in S$ with $\psi(T)$" defines a homomorphism $F\to H$, this must be said unique homomorphism (and we call it $\psi$ as well). By the given condition, $R\subseteq \ker\psi$, hence $N\le \ker\psi$. It follows that we obtain a unique homomorphism (again recycling the name) $\psi\colon \langle S\mid R\rangle \to H$ as desired.
