There are at least two ways of gluing an octagon to form a double torus. One is displayed in this YT video. There is another way by identifying opposite sides. Here is an image detailing the process.
Now, this construction is intrinsically different from the one linked in the video. The $cd^{-1}c^{-1}d$ path in the image is a loop the is homologous to zero, yet not null-homotopic. This is not true for the two pairs of opposite sides in the video.
A sequence of edges on the fundamental polygon can correspond to a loop on the resulting surface. For example, in the image, $adc^{-1}$ corresponds to a loop going around a hole in the double torus.
It is my suspicion that these loops generate the homotopy group, minus the trivial loop.
So, I ask: Do the homotopy and homology group generators of the quotient space uniquely correspond to edges of the fundamental polygon and the attaching word? Can you uniquely determine the generators given an octagon and the needed letters?
In the example above, the same edges correspond to different generators(Although in the end, the generators are all the same, generating the same homotopy and homology groups).
EDIT: I would also be glad to know if this holds true specifically for the torus or double torus. Additionally, if we are given the order of the gluing(a to b to c...), is it now guaranteed to be unique?