3. In a $9 \times 9$ grid, there are 81 small squares. In each small square, write a number. If in every row and every column, there are at most three different numbers, it can be guaranteed that there is a number in the grid that appears at least $n$ times in some row and at least $n$ times in some column. What is the maximum value of $n$? Prove your conclusion.

In a $9 \times 9$ grid, there are 81 small squares. In each small square, write a number. If in every row and every column, there are at most three different numbers, it can be guaranteed that there is a number in the grid that appears at least $n$ times in some row and at least $n$ times in some column. What is the maximum value of $n$? Prove your conclusion.
3. If a $9 \times 9$ grid is divided into 9 $3 \times 3$ grids, and each small cell in the same $3 \times 3$ grid is filled with the same number, and the numbers in any two different $3 \times 3$ grids are different, then each row and each column will have exactly three different numbers. Therefore, the maximum value of $n$ is no more than 3.

The following proof shows that as long as each row and each column have at most three different numbers, it can be guaranteed that there is a number in the grid that appears at least 3 times in a row and at least 3 times in a column.

When a number appears no less than 3 times in a row, mark the cells containing this number in that row with a symbol (1). Since each row has at most three different numbers, there are at most four cells in the same row that are not marked with a symbol (1), and at least five cells are marked with a symbol (1). Therefore, at least $5 \times 9$ cells in the entire grid are marked with a symbol (1).

Similarly, when a number appears no less than 3 times in a column, mark the cells containing this number in that column with a symbol (2).

By the same reasoning, at least $5 \times 9$ cells in the entire grid are marked with a symbol (2).

Since $5 \times 9 + 5 \times 9 > 9 \times 9$, there is at least one cell that is marked with both symbol (1) and symbol (2).

Clearly, the number in this cell appears at least 3 times in the row it is in and at least 3 times in the column it is in.
In conclusion, the maximum value of $n$ is 3.