3. Let $A_{1}, A_{2}, \ldots, A_{2 n}$ be pairwise distinct subsets of the set $\{1,2, \ldots, n\}$. Find the maximum value of

$$
\sum_{i=1}^{2 n} \frac{\left|A_{i} \cap A_{i+1}\right|}{\left|A_{i}\right| \cdot\left|A_{i+1}\right|}
$$

under the condition that $A_{2 n+1}=A_{1}$.
Solution: We will show that for all $i \neq j, \quad \frac{\left|A_{i} \cap A_{j}\right|}{\left|A_{i}\right| \cdot\left|A_{j}\right|} \leq \frac{1}{2}$. If $A_{i}$ and $A_{j}$ do not intersect, then this fraction is 0. Without loss of generality, assume that $\left|A_{i}\right| \leq\left|A_{j}\right|$. If they intersect, note that $\left|A_{j}\right| \geq 2$. Also, $\left|A_{i} \cap A_{j}\right| \leq\left|A_{i}\right|$. Therefore, $\frac{\left|A_{i} \cap A_{j}\right|}{\left|A_{i}\right| \cdot\left|A_{j}\right|} \leq \frac{1}{2}$. This means that the maximum value the sum can take is $n$. It is achieved for $A_{1}=\{1\}, A_{2}=\{1,2\}, A_{3}=\{2\}, A_{4}=\{2,3\}, \ldots, A_{2 n-1}=\{n\}, A_{2 n}=\{n, 1\}$.