Prove that there doesn't exist any function $f:\mathbb R \to \mathbb R$ that is continuous only at the rational points. Suggestion: For every $n \in \mathbb N$, consider the set $$U_n=\{x \in \mathbb R : \exists U \subset \mathbb R \,\text{open, with}\, x \in U, {\rm diam}(f(U))<1/n\}.$$
I am supposed to prove this statement using the Baire Category theorem. I am not sure but I think that the suggestion points towards trying to express $\mathbb R$ as the union of the sets $U_n$. If I could prove that any $U_n$ is a nowhere dense set and I affirm $\mathbb R=\bigcup_{n \in \mathbb N} U_n$, since the Baire Category theorem says that the interior of a countable union of nowhere dense sets is empty, I would get to an absurd. I have two problems: what does this have to do with the fact that there can't be any function $f$ continuous only at rational points? How can I assure that every $x \in \mathbb R$ is in some $U_n$? Moreover, is there any non-empty $U_n$?