Solution 1:

The $n$-holed torus has as fundamental group the group presented as

$$\langle a_1, b_1, \ldots, a_n, b_n \mid [a_1,b_1]\cdots[a_n,b_n] = 0\rangle$$

where $[a, b] = aba^{-1}b^{-1}$.

As an example, consider this octagon:

http://www.map.mpim-bonn.mpg.de/images/5/5e/Polygon_construction.png

Identify all corners, then identify the edges as labeled, and you get a 2-holed torus. The sequence $a_1b_1a_1^{-1}b_1^{-1}a_2b_2a_2^{-1}b_2^{-1}$ of edge labelings immediately gives you the generating relation for the fundamental group.