We call a coloring of an $m\times n$ table ($m,n\ge 5$) in three colors a [i]good coloring[/i] if the following conditions are satisfied: 1) Each cell has the same number of neighboring cells of two other colors; 2) Each corner has no neighboring cells of its color.
Find all pairs $(m,n)$ ($m,n\ge 5$) for which there exists a good coloring of $m\times n$ table.

[i](I. Manzhulina, B. Rubliov)[/i]
1. **Define the colors and the conditions:**
   Let the colors be \(1, 2,\) and \(3\). We need to satisfy two conditions for a good coloring:
   - Each cell has the same number of neighboring cells of the two other colors.
   - Each corner has no neighboring cells of its color.

2. **Construct a \(2 \times 3\) grid:**
   Consider the following \(2 \times 3\) grid:
   \[
   \begin{matrix}
   1 & 2 & 3 \\
   3 & 2 & 1 \\
   \end{matrix}
   \]

3. **Extend the grid to \(2 \times n\):**
   Reflect the \(2 \times 3\) grid over the rightmost edge repeatedly to form a \(2 \times n\) grid:
   \[
   \begin{matrix}
   1 & 2 & 3 & 3 & 2 & 1 & 1 & 2 & 3 & \cdots \\
   3 & 2 & 1 & 1 & 2 & 3 & 3 & 2 & 1 & \cdots \\
   \end{matrix}
   \]

4. **Extend the grid to \(m \times n\):**
   Reflect the \(2 \times n\) grid over the bottom edge repeatedly to form an \(m \times n\) grid:
   \[
   \begin{matrix}
   1 & 2 & 3 & 3 & 2 & 1 & 1 & 2 & 3 & \cdots \\
   3 & 2 & 1 & 1 & 2 & 3 & 3 & 2 & 1 & \cdots \\
   1 & 2 & 3 & 3 & 2 & 1 & 1 & 2 & 3 & \cdots \\
   3 & 2 & 1 & 1 & 2 & 3 & 3 & 2 & 1 & \cdots \\
   . & . & . & . & . & . & . & . & . & \cdots \\
   . & . & . & . & . & . & . & . & . & \cdots \\
   . & . & . & . & . & . & . & . & . & \cdots \\
   \end{matrix}
   \]

5. **Verify the conditions:**
   - Each cell in the grid has the same number of neighboring cells of the two other colors.
   - Each corner cell has no neighboring cells of its color.

6. **Generalize the construction:**
   The construction works for \(m \times n\) grids where \(2 \mid m\) and \(3 \mid n\). Similarly, we can construct a good coloring for \(m \times n\) grids where \(3 \mid m\) and \(2 \mid n\).

7. **Prove the necessity:**
   Assume the top-left corner is colored \(1\), the cell to its right is \(2\), and the cell below is \(3\):
   \[
   \begin{matrix}
   1 & 2 & \cdots \\
   3 & x & \cdots \\
   . & . & . \\
   . & . & . \\
   . & . & . \\
   \end{matrix}
   \]
   - If \(x = 2\), then the pattern forces \(2 \mid m\) and \(3 \mid n\).
   - If \(x = 3\), then the pattern forces \(2 \mid n\) and \(3 \mid m\).

8. **Conclusion:**
   The only pairs \((m, n)\) for which there exists a good coloring of an \(m \times n\) table are those where either \(2 \mid m\) and \(3 \mid n\) or \(2 \mid n\) and \(3 \mid m\).

The final answer is \( \boxed{ (m, n) } \) such that either \(2 \mid m\) and \(3 \mid n\) or \(2 \mid n\) and \(3 \mid m\).