A stone is placed in a square of a chessboard with $n$ rows and $n$ columns. We can alternately undertake two operations: 
[b](a)[/b] move the stone to a square that shares a common side with the square in which it stands;
[b](b)[/b] move it to a square sharing only one common vertex with the square in which it stands.

In addition, we are required that the first step must be [b](b)[/b]. Find all integers $n$ such that the stone can go through a certain path visiting every square exactly once.
1. **Coloring the Chessboard:**
   We color the chessboard in a repeating pattern of 1, 2, 3, and 4 as follows:
   \[
   \begin{array}{cccc}
   1 & 2 & 1 & 2 & \ldots \\
   4 & 3 & 4 & 3 & \ldots \\
   1 & 2 & 1 & 2 & \ldots \\
   4 & 3 & 4 & 3 & \ldots \\
   \vdots & \vdots & \vdots & \vdots & \ddots \\
   \end{array}
   \]

2. **Analyzing Moves:**
   - **(b) Move:** Moves the stone to a square sharing only one common vertex with the current square. This means the stone moves to a square of the same parity but different color.
   - **(a) Move:** Moves the stone to a square sharing a common side with the current square. This means the stone moves to a square of different parity.

3. **Path Analysis:**
   Consider a sequence of moves in groups of 4 squares: A, B, C, D.
   - A to B is a (b) move: A and B have the same parity but different colors.
   - B to C is an (a) move: B and C have different parities.
   - C to D is a (b) move: C and D have the same parity but different colors.

   This implies:
   - \(A\) and \(B\) have the same parity.
   - \(C\) and \(D\) have the same parity.
   - \(B\) and \(C\) have different parities.
   - \(A \neq B\) and \(C \neq D\).

   Therefore, \(\{A, B, C, D\} = \{1, 2, 3, 4\}\). Every 4 consecutive squares must include one of each color.

4. **Odd \(n\) Analysis:**
   Let \(n = 2k + 1\). The total number of squares is \(n^2 = (2k+1)^2 = 4k^2 + 4k + 1\).
   - We can decompose this path into \((k^2 + k)\) blocks of 4 squares and one final square.
   - Each block of 4 squares must contain one of each color (1, 2, 3, 4).

   However, there are only \(k^2\) squares of color 4 on the board. Since we need at least \(k^2 + k\) squares of each color, it is impossible to visit every square exactly once for odd \(n \geq 3\).

5. **Even \(n\) Analysis:**
   For even \(n\), let \(n = 2k\). The total number of squares is \(n^2 = (2k)^2 = 4k^2\).
   - We can decompose this path into \(k^2\) blocks of 4 squares.
   - Each block of 4 squares must contain one of each color (1, 2, 3, 4).

   Since there are exactly \(k^2\) squares of each color, it is possible to visit every square exactly once for even \(n\).

Conclusion:
For the stone to visit every square exactly once, \(n\) must be even.

The final answer is \( \boxed{ n } \) must be even.