connected but not path-connected sets Let $S\in[0,1]^2$ be defined as follows:
$$(x,y)\in S \Leftrightarrow \begin{cases}y\in[0, \frac{1}{q}], &x=\frac{p}{q}\in\mathbb{Q} \text{ with } q \text{ even}\\
y\in[1-\frac{1}{q}, 1], &x=\frac{p}{q}\in\mathbb{Q} \text{ with } q \text{ odd}\\
y\in[0,1], &\text{otherwise}\end{cases}$$
, where for every $x\in\mathbb{Q}$, the fractional representation $\frac{p}{q}$ is lowest in terms of $q>0$. Prove that $A$ is connected, but not pathwise connected.
I found that proving the connectedness of $S$ directly from definition is hard. So I'm trying to prove it using the property of connectedness that if $A\subset S\subset \bar{A}$, where $A$ is connected, then $S$ is connected. However, I'm having trouble finding this connected subset $A$. Any suggestions?

Suppose we had two non-empty clopen sets $U, V$ partitioning $S$. Each set of the form $\{x\} \times [0, 1] \subseteq S$, where $x \in [0, 1] \setminus \Bbb{Q}$, must be entirely contained in $U$ or entirely contained in $V$, since each such subset is connected.
Let $A = \{x \in [0, 1] \setminus \Bbb{Q} : \{x\} \times [0, 1] \subseteq U\}$ and similarly define $B$ in relation to $V$. I claim that $A$ and $B$ are clopen in $[0, 1] \setminus \Bbb{Q}$. To see $A$ is open, suppose $x \in A$. Then $(x, 0) \in U$, which is open, hence a ball $B_S((x, y); r)$ exists in $U$. It's straight forward to verify that $B_A(x; r) \subseteq A$. Similarly, $B$ is open, and given both partition $[0, 1] \setminus \Bbb{Q}$, $A$ and $B$ are both clopen.
Due to the density of the irrationals, and the fact that $U, V$ are open and non-empty, we can also verify that $A$ and $B$ are both non-empty.
Consider now the closures of $A$ and $B$ in $[0, 1]$. The density of the irrationals imply that the closures of these sets cover $[0, 1]$. By the connectedness of $[0, 1]$, there must exist some point in their intersection. That is, there exists some $x$ that is simultaneously the limit (in $[0, 1]$) of a sequence $a_n \in A$ and a sequence $b_n \in B$. As both $A$ and $B$ are closed and disjoint, we must have $x \in \Bbb{Q}$.
Now, if $x$ has even lowest denominator, then consider the sequences $(a_n, 0)$ and $(b_n, 0)$. If $x$ has odd lowest denominator, then consider the sequences $(a_n, 1)$ and $(b_n, 1)$. In either case, each sequence respectively belongs to $A$ and $B$, converging to a point in $S$. As $U$ and $V$ are closed, this would produce a point in $U \cap V$, contradicting $U$ and $V$ being disjoint, and proving connectedness.
