Do there exist two discontinuous surjective functions $f,g: \mathbb{R} \to \mathbb{R}$ such that the only one composition of them $f(g(x))$ or $g(f(x))$ is continuous?
I tried to use $x$ for rational and $-x$ for irrational numbers, and something similar but this is failed.