Can you help me understand Pollard's rho example? I'm studying the Pollard's rho algorithm to solve discrete logaritms on the Handbook of applied cryptografy but I didn't understand one part of the theory and looking at the example gets me more confused.
This is the example



The first thing that I don't understand is how do you know that an element is on $S_1$ or $S_2$ or $S_3$ (in general not in in this example because is explained)and the second thing is: where did he get mod 3?
The algorithm is clear about all your questions. The partitions of $G=\mathbb{Z}^{*}_{383}$ are the sets
$$S_1=\{x \in G: x \bmod 3=1\}$$
$$S_2=\{x \in G: x \bmod 3=0\}$$
$$S_3=\{x \in G: x \bmod 3=2\}$$
Here are the left parts ($x_i$) of the computation slightly more detailed with $x_i \bmod 3$ and the corresponding sets $S_k$

i    x_i    x_i mod 3  S_k          x_(i+1)
1    228        0       2       228^2 mod 383 = 279
2    279        0       2       279^2 mod 383 = 92
3     92        2       3       2*92  mod 383 = 184
4    184        1       1     228*184 mod 383 = 205
5    205        1       1     228*205 mod 383 = 14
6     14        ...