Let $f:\mathbb{R} \to \mathbb{R}$ be a function with the intermediate value property: that is, $f$ maps intervals to intervals. Let $x \in \mathbb{R}$. Suppose to each sequence $ (x_n) $ converging to $x$ there exists a constant $M$ such that $$|f(x) - f(x_n)| ≤M \sup _{n,m}|f(x_n) - f(x_m)|$$ Then show that $f$ is continuous at $x$.
How can I solve this problem? Can anyone help me please. I have the basic idea of real analysis but could not crack this problem.