So I am given a continuous function mapping a connected domain to the reals, i.e $$f: (a,b) \rightarrow \mathbb{R}$$ I want to show that if $f$ is not strictly monotone and f is continuous, we have $x,y,z \in (a,b)$ with $x < y < z$ such that: $$f(x) \leq f(y) \text{ and } f(y) \geq f(z)$$
or
$$f(x) \geq f(y) \text{ and } f(y) \leq f(z)$$
As for what I've tried, using the negation of strictly monotone, we have that $f$ must be increasing and decreasing in two intervals $[x_1,x_2]$ and $[x_3, x_4]$ i.e: $$f(x_1) \leq f(x_2) \text{ and } f(x_3) \geq f(x_4)$$
or
$$f(x_1) \geq f(x_2) \text{ and } f(x_3) \leq f(x_4)$$
The problem comes when I look to combine the two into a single inequality. In an effort to combine these, the only way I see of doing it (directly) would be casewise. If anyone could provide a hint or (less preferred) a complete direct proof I would appreciate it.
Use proof by contradiction. If your statement is false, then for every $x < y < z$, we have $$f(x) > f(y) \quad \textrm{ or } \quad f(y) < f(z)$$ and $$f(x) < f(y) \quad \textrm{ or } \quad f(y) > f(z).$$