Let $f_n: \mathbb{R} \to \mathbb{R}$ for $n \in \mathbb{N}$ be continuous function. Suppose that for any $x \in \mathbb{R}$ there is some $n$ such that $f_n(x) \in \mathbb{Q}$. Prove that for every $c < d$ in $\mathbb{R}$, one can find some numbers $a < b$ in the interval $(c,d)$ and $n \in \mathbb{N}$ such that $f_n$ is constant on $(a,b)$.
My intuition for this question is that I would want to use something like the intermediate value theorem (a related question here does that)? But I'm not sure how everything goes together.