Solution (source code)

= Solution

Introduce $d=c^2$ and $e=a^2$. The two vertex groups
$$
A=\langle a,d\mid ada^{-1}=d^{-1}\rangle,
\qquad
B=\langle c,e\mid cec^{-1}=e^{-1}\rangle
$$
are <Klein bottle group>[Klein bottle groups]. In $A$, the subgroup $\langle a^2,d\rangle$ is $\mathbb Z^2$ of index two; in $B$, the subgroup $\langle e,c^2\rangle$ is also $\mathbb Z^2$ of index two. Identifying
$$
e=a^2,\qquad d=c^2
$$
gives
$$
G\cong
A*_{\langle a^2,c^2\rangle}B.
$$
Eliminating $d,e$ from this <amalgamated free product> recovers exactly the two given relators.

The <Bass-Serre tree> is bipartite with vertex sets $G/A$ and $G/B$ and edge set $G/\langle a^2,c^2\rangle$. Both edge-group inclusions have index two, so every vertex has degree two. The tree is therefore a bi-infinite line, with $A$- and $B$-type vertices alternating.