generators of the fundamental group of some subset of the cartesian product

let $X$ be a topological space. let $D=\{(x_1,x_2,x_3)\,|\, x_1=x_2\}\subset X^3$ suppose that $\pi_1(X)$ is generated by $g_i, i\in I$ what are the generators of $\pi_1(D)$?

I read that they are elements of the form $(g_i,g_i,1)$ and $(1,1,g_i)$ why?

-

$D$ is homeomorphic to $X^2$ via $f:X^2\ni(x,y)\mapsto (x,x,y)\in D$. Since $\pi_1(X^2)\cong\pi_1(X)\times\pi_1(X)$, we also have $\pi_1(D)\cong\pi_1(X)\times\pi_1(X)$. The induced homomorphism (in this case isomorphism) $f_*$ maps $(g,h)$ to $(g,g,h)$.