Showing $\mathbb{Q}$ is homeomorphic to $\mathbb{Q}^2$

Let $\mathbb{Q}$ be the set of rationals, as relative topology to $\mathbb{R}$.

How to show that $\mathbb{Q}$ is homeomorphic to $\mathbb{Q}^2$?

More general, if $T$ is a countable dense space(no isolated poiont) with every singleton closed, how to show that $T^2$ is homeomophic to $T$.


The easiest way is to prove that $\mathbb{Q}$ is the unique (up to homeomorphism) countable metric space without isolated points. Three proofs can be found here.