Example 5 Let $A=\{1,2,3,4,5,6\}, B=\{7,8,9, \cdots, n\}$. Take 3 numbers from $A$ and 2 numbers from $B$ to form a set $A_{i}(i=1,2, \cdots, 20)$ with 5 elements, such that $\left|A_{i} \cap A_{j}\right| \leqslant 2,1 \leqslant i<j \leqslant 20$, find the minimum value of $n$. (2002 China National Training Team for IMO)
We first prove: Each element in $B$ appears in the subsets $A_{i}(i=1,2, \cdots, 20)$ at most 4 times. If not, assume that an element $b$ in $B$ appears $k(k>4)$ times in the subsets $A_{i}(i=1,2, \cdots, 20)$. Consider the $k$ subsets containing $b$, they contain $3k > 12$ elements from $A$. Thus, by the pigeonhole principle, there is at least one element, say $a$, appearing 3 times in these $k$ subsets. Let these 3 subsets containing both $a$ and $b$ be $P, Q, R$. Then, the 5 elements in $A \backslash\{a\}$ appear $2 \times 3 = 6$ times in $P, Q, R$. Therefore, there must be an element $c$ appearing 2 times, leading to 2 subsets containing $a, b, c$, which contradicts the condition $\left|A_{i} \cap A_{j}\right| \leqslant 2$.

From the above, each element in $B$ appears in the subsets $A_{i}(i=1,2, \cdots, 20)$ at most 4 times. The total number of appearances of elements in $B$ in the subsets $A_{i}(i=1,2, \cdots, 20)$ is $2 \times 20 = 40$, so $|B| \geqslant \frac{40}{4} = 10$, and thus $n \geqslant 10 + 6 = 16$.

Finally, when $n=16$, there exist 20 sets that meet the conditions of the problem: $\{1,2,3,7,8\}$,
$$\begin{array}{l}
\{1,2,4,12,14\}, \{1,2,5,15,16\}, \{1,2,6,9,10\}, \{1,3,4,10,11\}, \\
\{1,3,5,13,14\}, \{1,3,6,12,15\}, \{1,4,5,7,9\}, \{1,4,6,13,16\}, \\
\{1,5,6,8,11\}, \{2,3,4,13,15\}, \{2,3,5,9,11\}, \{2,3,6,14,16\}, \\
\{2,4,5,8,10\}, \{2,4,6,7,11\}, \{2,5,6,12,13\}, \{3,4,5,12,16\}, \\
\{3,4,6,8,9\}, \{3,5,6,7,10\}, \{4,5,6,14,15\}.
\end{array}$$

In conclusion, the minimum value of $n$ is 16.