Connectedness of the level set of continuous map Please tell me this proposition.
$X$:a compact Hausdorff topological space
$Y$:a Hausdorff space
$f:X \rightarrow Y$:continuous
$S \subset X $: dense
$f(S) \subset f(X)$ : dense 
$\forall y' \in f(S) , f^{-1}(y')$ is connected.
$\Rightarrow \forall y \in f(X), f^{-1}(y)$ is connected.
I've aleady considered this problem almost 40 hours but I cannot solve this.
This is my poor proof.
proof)$\forall y \in f(X\smallsetminus S)=f(X)\smallsetminus f(S)$ $\exists \{y_{n}\}_{n \in \mathbb{N}}$ s.t. 
$y_{n} \rightarrow y(n \rightarrow \infty) (\because \overline{f(S)}=f(X))$ i.e. 
$ \forall V$ open nbd of $ y$ $\exists$ $n_0 \in \mathbb{N}$ s.t.
$n \geq n_0 \Rightarrow y_{n} \in V$
Assume that $f^{-1}(y)$ is not connected.
$\exists U, U'$: open s.t.
 $f^{-1}(V)=U\cap U' , U\cap U' \cap f^{-1}(y)=\emptyset$
$\therefore \exists x \in U, \exists x' \in U'$ s.t. 
$\exists \{x_n\}_{n \in \mathbb N} , \exists \{x'_n\}_{n \in \mathbb N}$ s.t. 
$f(x_n) = f(x'_n) = y_n , x_{n} \rightarrow x, x'_{n} \rightarrow x'(n \rightarrow \infty)$ i.e.
$n \geq n_0 \Rightarrow x_{n} \in U \cap f^{-1}(y_n), x'_{n} \in U' \cap f^{-1}(y_n)$
In this imperfect proof , I can't prove disconnectedness of $f^{-1}(y_{n})$ neither get any contradiction, even if I assume $\emptyset \neq U\cap U'\cap f^{-1}(y_n)$.
 A: I think, you are trying to prove the following:
Proposition. Suppose that $X$ and $Y$ are Hausdorff topological spaces and $X$ is compact. 
Let $f: X\to Y$ be a continuous map. Let $S\subset X$ be a dense subset such that: For each $y'\in f(S)$, $f^{-1}(y')$ is connected. Then for each $y\in f(X)$, $f^{-1}(y)$  is connected. 
This proposition is false, here is a counter-example. Let $Y={\mathbb R}$ (with the standard topology) and 
$$
X= \{1, -1, -1-\frac{1}{2n+1}, 1+ \frac{1}{2n}: n\in {\mathbb N}\}\subset {\mathbb R},
$$
equipped with the subspace topology. (I do not include $0$ in the set of natural numbers.) 
Let $f(x)= |x|$. Let 
$$
S= \{-1- \frac{1}{2n+1},  1+ \frac{1}{2n}: n\in {\mathbb N}\}\subset X. 
$$ 
I will leave you to check that $S$ is dense in $X$ and that $X$ is compact. For each $y'\in f(S)$, the preimage $f^{-1}(y')$ is a single point which is either $ -1-\frac{1}{2n+1}$ or $1+ \frac{1}{2n}$. Hence, $f^{-1}(y')$ is connected for such $y'$. At the same time, for $y=1$, $f^{-1}(y)=\{1, -1\}$ is not connected. 
