Characterization of transitive topological dynamical system on metric space without isolated points I have been working on the following topological dynamics problem for a few hours now and I do not seem to find a solution:

Let $(X, d)$ be a metric space without isolated points and $f\colon X\to X$ be a dynamical system (in particular $f$ in continuous). Prove that if for any $\epsilon>0$ and any two points $x,y\in X$ there exists $z\in X$ and $k,n\geq 0$ such that $$d(f^k(z), x) < \epsilon\quad \text{and} \quad d(f^n(z), y) < \epsilon$$ then $f$ is transitive.

I have tried various approaches but none of them seemed to work. I have also tried to find a book with this problem as an exercise but I had no luck with that either.
My working definition of transitivity is:

A dynamical system $f\colon X\to X$ is transitive if for any two non-empty open subsets $U, V\subset X$ there exists an $n\geq 0$ such that $f^n(U)\cap V \neq \emptyset$.

Mainly, I'm wondering how the "no isolated points" property can be exploited. I'd be glad for some hints/solutions.
 A: Suppose that $f$ is not transitive.
Then there are non-empty open subsets $U,V$ such that $f^n(U) \cap V = \emptyset$ forall $n \ge 0$.
Using your hypothesis with some open balls contained in $U$ and $V$, we can deduce that there is a trajectory that goes through $V$ and then through $U$ : there is a $w \in X$ and integers $0\le p<q$ such that $f^p(w) \in V$ and $f^q(w) \in U$.
Let $n=q-p \ge 0$. Since $f^n$ is continuous, $(f^n)^{-1}(U)$ is open, and letting $V' = V \cap (f^n)^{-1}(U)$ (a non-empty open set), we have $f^n(V') \subset U$.
Now, we know that any point in $V'$ will be sent to $U$ after $n$ steps. Since it is forbidden to visit $V$ after visiting $U$, this shows that a trajectory cannot visit $V'$ too many times.
If $m_0$ is the smallest index such that $f^{m_0}(w) \in V'$, then $f^{m_0+n}(w) \in U$ and so from $w \ge m_0+n$, $f^m(w) \notin V'$, which leaves at best $n$ indices $m_0,m_0+1,\ldots, m_0+n-1$ for which it is allowed to have $f^m(w) \in V'$.
Then, to reach a contradiction, we only have to show that forall $n$ there exist trajectories that visit $V'$ at least $n$ times.
We show this by induction. It is fairly obvious that there is a trajectory that goes through $V'$ at least once.
Now let $n \ge 1$ and suppose we have a trajectory that visits $V'$ at least $n$ times : we have a $w \in X$ and $n$ indices $m_1 \ldots m_n$ such that $w_i = f^{m_i}(w) \in V'$. If any two $w_i$ are equal then the trajectory is periodic and we are done. If not, since $w_1$ isn't an isolated point, there is a point $z \in V'$ such that $z$ is distinct from all the $w_i$.
Then pick $d>0$ such that the open balls $B_i = B(w_i,d)$ and $B_0 = B(z,d)$ are pairwise disjoint and contained in $V'$. Since all the $f^{m_i-m_1}$ are continuous, we can find $\epsilon > 0$ such that $f^{m_i-m_1}(B(w_1,\epsilon)) \subset B_i$ forall $i \in \{1 \ldots n\}$.
Now we apply your hypothesis with $\epsilon$, $z$, and $w_1$. This tells us that there exists a trajectory that comes within $\epsilon$ of $z$ and $w_1$. From our choice of $\epsilon$, we deduce that this trajectory comes within $d$ of $z$ and all of the $w_i$. Since those $n+1$ balls are disjoint and contained in $V'$, this trajectory does meet $V'$ at least $n+1$ different times.
