Help with understanding homotopy commutative diagrams.

I'm self-studying homotopy and homology and I think I understand the base material but I don't really know what "tools I have in my kit" when it comes to proofs using homotopy commutative diagrams. For example, I am stuck on the following question:

Let $Y$ be a H-space with multiplication $m_Y$. Suppose there are maps $f:A \rightarrow Y$ and $g:B \rightarrow Y$ such that the composite $$e:A \times B \xrightarrow{f\times g} Y \times Y \xrightarrow{m_Y} Y$$ is a homotopy equivalence. Let $Z$ be another H-space and suppose that there is an H-map $h:Y \rightarrow Z$. Let $h_1, h_2$ be the composites $$h_1:A\xrightarrow{f}Y\xrightarrow{h}Z$$ $$h_2:B\xrightarrow{g}Y\xrightarrow{h}Z$$ Suppose that $h_1$ is null homotopic.

Show that there is a homotopy commutative diagram:

$\hspace{7cm}$

for some map $r$ and deduce that $h$ is null homotopic if and only if both $h_1$ and $h_2$ are null homotopic.

As $e$ is a homotopy equivalence I know that there must exist an $e'$ such that $e \circ e' = id_Y$ and $e' \circ e = id_{A \times B}$. Do I have enough information here to find r and make the above deduction?

I'm thinking that I need to start by taking $Y$ to $A \times B$ by using $e'$ but I'm not sure if I have any way to get from $A \times B$ to $B$ or what the significance of $h_1$ being null homotopic is.