# Homomorphism between profinite groups is continuous if and only if the preimage of all open normal subgroups is open

I'm stuck with the proof of the following:

Let $G,H$ be profinite groups and $f: G\rightarrow H$ be a homomorphism. Show that $f$ is continous if and only $f^{-1}(N)$ is open in $G$ for every open normal subgroup $N$ in $H$.

If $f$ is continous then the statement holds obviously.

So let $f^{-1}(N)$ be open in $G$, for all open normal subgroups $N<H$. I want to show that $f^{-1}(U)$ is open in $G$ fo every open set $U \subset H$ . Since $G$ and $H$ are profinite, they are compact totally disconnected and so every open set in H is a union of cosets of open normal subgroups. $U=\bigcup Nh$ for some $h\in H$.

But from this point on I don't know how to continue. Any hint would be nice