Computing the homology of genus $g$ surface, using Mayer-Vietoris
$H_1(U\cap V)$ is generated by the attaching map of the 2-cell which includes each generator twice, once with $+$ sign and once with $-$ sign. Therefore it is homologous to zero. Hence the map $\mathbb{Z}\to \mathbb{Z}^{2g}$ is the zero map. Hence $H_2(X)=\mathbb{Z}$ and $H_1(X)=\mathbb{Z}^{2g}$.