How to show $f$ is continuous at $x$ IFF for any sequence ${x_n}$ in $X$ converging to $x$ the sequence $f(x_n)$ converges in $Y$ to $f(x)$

Let $f : (X, d_X) \to (Y, d_Y )$ be a map between two metric spaces. Recall that $f$ is called continuous at $x ∈ X$ if for any open ball $B_f(x)(ϵ)$ of radius $ϵ$ around $f(x)$ there exists a ball $B_x(δ)$ of radius $δ$ around $x$ such that $f(B_x(δ))⊂B_f(x)(ϵ)$. Show that $f$ is continuous at $x$ if and only if for any sequence ${x_n}$ in $X$ converging to $x$ the sequence $f(x_n)$ converges in $Y$ to $f(x)$. Hint: imitate the proof of the corresponding statement for functions $R → R$.

Suppose $f$ preserves limits of sequences but is not continuous at $x$. Then there exists an $\varepsilon>0$ such that for all $\delta>0$ there exists a point $y$ with $d_X(x,y)<\delta$ but $d_Y(f(x),f(y))>\varepsilon$. Then we construct a sequence of $\delta_i$ tending to 0, and select $y_i$ so that where $d_X(x,y_i)<\delta_i$. Then this sequence tends to $x$ but its image does not tend to $f(x)$.
Conversely, suppose $f$ is continuous, and let $x_n$ tend to $x$. Fix any $\varepsilon>0$. Since $f$ is continuous, there exists a ball of radius $\delta$ such that $d_X(x,y)<\delta$ implies $d_Y(f(x),f(y))<\varepsilon$. Then since the $x_n$ are eventually all within the $\delta$-ball centered at $x$, their images are eventually all in the $\epsilon$-ball centered at $f(x)$. Thus $f(x_n)$ converges to $f(x)$.