Let $S = \{a,b\}$ be a generating set for a group $G$. If a non-trivial word in $a, b \in S$ equals the identity $e$ of $G$, i.e., $$a^{p_1} b^{q_1} a^{p_2} b^{q_2} \ldots a^{p_n} b^{q_n} = e$$ for some $n \in \mathbb N$ and $\{p_j\}_{j=1}^n \subset \mathbb Z$, $\{q_j\}_{j=1}^n \subset \mathbb Z$ where not all $p_i,q_i$ are zero, then, show, using the universal property of free groups, that $S$ is not a free generating set for the group $G$.
Proof Attempt. For the sake of contradiction, let $S$ be a free generating set of $G$, and denote the inclusion map by $i: S \hookrightarrow G$.
Suppose $\sum_i p_i \ne 0$ or $\sum_i q_i \ne 0$. Consider the map $\phi: S \to \Bbb Z \times \Bbb Z$ given by $\phi(a) = (1,0)$ and $\phi(b) = (0,1)$. By the universal property of free groups, there exists a unique group homomorphism $\widetilde \phi: G \to \Bbb Z \times \Bbb Z$ such that $\phi = \widetilde \phi \circ i$. Then, $$\widetilde \phi(a^{p_1} b^{q_1} a^{p_2} b^{q_2} \ldots a^{p_n} b^{q_n}) = \widetilde \phi(e) = (0,0)$$ gives $$p_1 \widetilde \phi(a) + q_1\widetilde \phi(b) + p_2\widetilde \phi(a) + q_2 \widetilde \phi(b) + \ldots + p_n \widetilde \phi(a) + q_n \widetilde \phi(b) = (0,0)$$ and $\widetilde \phi(a) = \phi(a), \widetilde \phi(b) = \phi(b)$ simplifies the above expression to $$\left(\sum_i p_i, \sum_i q_i \right) = (0,0)$$ This contradicts the hypothesis that $\sum_i p_i \ne 0$ or $\sum_i q_i \ne 0$. Thus, $S$ is not a free generating set of $G$.
Question: How should I proceed when $\sum_i p_i = 0$ and $\sum_i q_i = 0$?
Remark: The argument above for the case when $\sum_i p_i \ne 0$ or $\sum_i q_i \ne 0$ can be easily extended to work for larger generating sets, i.e., any set $S$ containing $\{a,b\}$. Define the map $\phi: S \to \Bbb Z^3$ by $\phi(a) = (1,0,0)$, $\phi(b) = \phi(0,1,0)$, and $\phi(s) = (0,0,1)$ for any $s \in S \setminus\{a,b\}$. This extends to a unique group homomorphism $\widetilde \phi: G \to \Bbb Z^3$ such that $\phi = \widetilde \phi \circ i$ and a similar argument as above suffices. I'd like the argument for the second case ($\sum_i p_i = 0$ and $\sum_i q_i = 0$) to easily extend to larger generating sets $S$ also.
Thanks!