Let $H$ be the upper half plane and let $f : H → \mathbb C$ be
holomorphic on $H$ and continuous on $\bar{H}$. Suppose that $f$ is constant on the real line, that is, there is $c ∈ \mathbb C$ such that $f(x) = c$ for all $x ∈ \mathbb R$. 
Show that $f$ is constant.

My attempt:

I tried proving this using Liouville's theorem.

Since $f$ is continuous on $\bar{H}$, then it is continuous at each $p \in \bar{H}$, so for all $\epsilon > 0$, there exists $\delta > 0$ s.t if $|z-p|< \delta$, then $|f(z) - f(p)|< \epsilon$.

Choose $\epsilon = 1$

Now we can rewrite $|f(z)|$ as: $|f(z) - f(p) + f(p)| ≤ |f(z) - f(p)| + |f(p)| ≤ 1 + |f(p)|$

Let $M := 1 + |f(p)|$

Hence $|f(z)| ≤ M$ and hence $f$ is bounded on $\bar{H}$

But since $p \in \bar{H}$, it can also lie on the real line, so $f(p) = c$ for some $c \in \mathbb C$ and thus $|f(p)| = |c|$ and hence $f$ is bounded on $H$.

Therefore, by Liouville's theorem, if a function is holomorphic and bounded, it must be constant. 

Hence $f$ is constant.

Is my attempt correct? Any other answers?