Suppose $G_1, G_2, H_1, H_2$ are finite abelian groups with $G_1 \times G_2 \cong H_1 \times H_2$, and $G_1 \cong H_1$. Prove that $G_2 \cong H_2$.
Since the groups are finite, the isomorphisms imply equal orders, so $|G_2| = |H_2|$. And by the fundamental theorem of abelian groups, $G_1 \times G_2$ must have the same prime-power cyclic group decomposition as $H_1 \times H_2$, and similarly, $G_1$ and $H_1$ have the same decomposition. I'm not entirely sure what to do from here. I feel like the fundamental theorem should get me most of the way there, I just don't know how to say it. Or should I try constructing the isomorphism from the two isomorphisms I've assumed? Any push in the right direction would be greatly appreciated.