5. In a computer game, one person can play as one of three factions: $T, Z$ or $P$. There is a network play mode in which 8 players are divided into two teams of 4 players each. How many different matches can there be, differing in the sets of factions? Matches are considered different if one match has a team that the other does not. The order of the teams and the order of listing the factions in the team do not matter. For example, matches $(P Z P T ; T T Z P)$ and $(P Z T T ; T Z P P)$ are considered the same, while matches $(P Z P Z ; T Z P Z)$ and $(P Z P T ; Z Z P Z)$ are different.
Solution. First, let's calculate the number of ways to form one team from the specified factions. Let's number the factions. The number of options is equal to the number of solutions to the equation $x_{1}+x_{2}+x_{3}=4, x_{i} \geqslant 0$, where $x_{i}$ is the number of players from faction $i$. The number of solutions can be found using the formula for combinations with repetition: $C_{4+3-1}^{3-1}=15$ or by directly listing the options. We will divide all match options into two sets based on whether the teams are the same. If the teams are the same, we get 15 matches, and if they are different, we get $C_{15}^{2}=105$. Thus, we get the answer: $15+105=120$ matches. Answer: 120.