7. In the game "set," all possible four-digit numbers consisting of the digits $1,2,3$ (each digit appearing exactly once) are used. It is said that a triplet of numbers forms a set if, in each digit place, either all three numbers contain the same digit or all three numbers contain different digits.

The complexity of a set is defined as the number of digit places where all three digits are different.

For example, the numbers 1232, 2213, 3221 form a set of complexity 3 (in the first place, all three digits are different, in the second place, only the digit 2 appears, in the third place, all three digits are different, and in the fourth place, all three digits are different); the numbers $1231,1232,1233$ form a set of complexity 1 (in the first three places, the digits are the same, and only in the fourth place are all digits different). The numbers 1123, 2231, 3311 do not form a set at all (in the last place, two ones and a three appear).

Which sets have the highest complexity in the game, and why?
Solution. Note that for any two numbers, there exists exactly one set in which they occur. Indeed, the third number of this set is constructed as follows: in the positions where the first two numbers coincide, the third number has the same digit; in the position where the first two numbers differ, the third number gets the remaining digit. For example, for the numbers 1231 and 1223, the third in the set will be 1212.

Let's call an "ordered set" a set of three four-digit numbers with their order taken into account. Note that each unordered set $\{a, b, c\}$ corresponds to six ordered sets: $(a, b, c)$, $(a, c, b)$, $(b, a, c)$, $(b, c, a)$, $(c, a, b)$, $(c, b, a)$. Therefore, instead of the number of unordered sets, we can compare the number of ordered sets (which is six times more). Each ordered set $(a, b, c)$ is uniquely determined by an ordered pair of numbers $(a, b)$.

Let's count the number of ordered sets of complexity $k>0$. Each such set can start with any number $a$ (81 options). In this number, we need to choose $k$ positions ($C_{4}^{k}$ ways to choose) and replace the digit in each of them with one of the two different ones ($2^{k}$ ways). As a result, we get a number $b$, which uniquely determines the set. In total, we get $81 \cdot C_{4}^{k} \cdot 2^{k}$ ordered sets of complexity $k$.

Comparing the numbers $f(k)=C_{4}^{k} \cdot 2^{k}$ for different $k$, we get: $f(1)=8$, $f(2)=24$, $f(3)=32$, $f(4)=16$. As we can see, the largest number of sets has complexity $k=3$.

Answer: the most sets have complexity 3.