Each cell of an infinite table (infinite in all directions) is colored with one of $n$ given colors. All six cells of any $2\times 3$ (or $3 \times 2$) rectangle have different colors. Find the smallest possible value of $n$.
1. **Understanding the Problem:**
   We need to color an infinite table such that any \(2 \times 3\) or \(3 \times 2\) rectangle has all six cells colored differently. We aim to find the smallest number \(n\) of colors required to achieve this.

2. **Initial Consideration:**
   Let's consider the constraints. For any \(2 \times 3\) or \(3 \times 2\) rectangle, all six cells must have different colors. This implies that we need at least 6 colors to start with, but we need to check if 6 colors are sufficient or if more are needed.

3. **Construction with 8 Colors:**
   We propose a construction using 8 colors. We can divide the infinite table into strips of width 2, alternating between two sets of colors. For example, we can use the following pattern:

   - Strip 1: Colors \(C_1, C_2, C_3, C_4\)
   - Strip 2: Colors \(C_5, C_6, C_7, C_8\)

   This pattern ensures that no \(2 \times 3\) or \(3 \times 2\) rectangle will have repeated colors because each strip will have a unique set of colors, and the alternating pattern ensures that adjacent strips do not repeat colors within the required rectangle dimensions.

4. **Verification:**
   To verify, consider any \(2 \times 3\) rectangle. It will span across two strips, and since each strip has a unique set of 4 colors, the rectangle will have 6 different colors. The same logic applies to any \(3 \times 2\) rectangle.

5. **Proof by Contradiction:**
   Suppose \(n < 8\). If we use fewer than 8 colors, then by the pigeonhole principle, at least one color must repeat within any \(2 \times 3\) or \(3 \times 2\) rectangle, violating the problem's condition. Therefore, \(n = 8\) is the smallest number of colors required.

\(\blacksquare\)

The final answer is \( \boxed{ 8 } \).