Let $f$ and $g$ be injective functions such that $f$ is a mapping from $A$ to $B$ and $g$ is a mapping from $B$ to $A$. Define an equivalence relation R on $A$ by $s_1= g \circ f (s_2)$ or $s_2= g \circ f (s_1)$. Define a similar equivalence relation on $B$. For $s \in A$, we write $[s]$ for the class in $A/R$. Similar for the class in $B/\bar R$.
Define a map $H : A/R \to B/\bar R$ by $H([s]) = [f(s)]$.
How can I prove that $H$ is well-defined, injective and surjective?