In the proof of Proposition 6.2 in Farb & Margalit, "A primer on mapping class groups", an analog of the Euclidean algorithm is used to construct a simple, closed representative (oriented) curve for a primitive element of $H_{1} (S_{g} ; \mathbb{Z})$, where $S_{g}$ is a surface of genus $g$. This was shown earlier (Theorem 1.5 ibid.) to hold for $\mathbb{T}^{2} =: S_{1}$.

For a primitive $[x] = (v_{1}, w_{1}, \ldots, v_{g}, w_{g}) \in H_{1} (S_{g} ; \mathbb{Z})$, the result for the $\mathbb{T}^{2}$ is used to write $[x] = \sum_{j = 1}^{g} \mathrm{gcd} (v_{j}, w_{j}) [\gamma_{j}]$. The proof proceeds by using a Euclidean-algorithm-type process to combine these $\mathrm{gcd} (v_{j}, w_{j}) [\gamma_{j}]$ together, starting for $j = 1, 2$ and iterating further across $j$, always obtaining homologous simple, closed curves.

My question is about this combining process. Here is the figure from the proof in question; it shows how the first step in the process works for $g = 2$ with $[x] = 3 [\gamma_{1}] + 2 [\gamma_{2}]$, wherein one copy of $[\gamma_{1}]$ (left) is "surgered" to a copy of $[\gamma_{2}]$ (right).

As described in the proof, this process should be repeated until there are only $\mathrm{gcd} (v_{1}, w_{1}, v_{2}, w_{2}) = \mathrm{gcd} (3 , 2) = 1$ curve(s) left. It is easy to see the at least one more "surgering" is possible of one curve on the left to one on the right, leaving a total of $3$ curves.

However, continuing this process does not seem so straightforward. Those $3$ curves comprise one "leftover" copy of $[\gamma_{1}]$ and the two "surgered" curves. It is possible in a roundabout way to combine that leftover curve with the outer of the two "surgered" curves, but then it does not seem possible with the two remaining curves.

How should this last simple, closed curve obtained? What is a good way to think about this process generally? References?