Task B-1.6. Marko is trying to guess the three numbers that Andrea, Barbara, and Dora have thought of and written down. They do not want to reveal how many digits these numbers have, only that all three numbers are written with different digits in ascending order. Each digit, except zero, is used somewhere. After several questions, Marko found out that Andrea's and Barbara's numbers share only the digits 3 and 8, Andrea's and Dora's numbers share only the digits 8 and 9, and Barbara's and Dora's numbers share only the digit 8. Each of the digits 1, 2, 3, 4, 8, and

9 is used by Andrea or Barbara (at least one of the two). Similarly, each of the digits $1,2,3,5,6,7,8,9$ is used by Andrea or Dora, and each of the digits 3, 4, 5, 6, 7, 8, 9 is used by Barbara or Dora. Marko has learned enough and can now guess the numbers. Which number did each of the girls think of?
## Solution.

We solve the problem using sets and Venn diagrams. Let $A$ be the set of digits of the number Andrea thought of, $B$ be the set of digits of the number Barbara thought of, and $D$ be the set of digits of the number Dora thought of. We are looking for sets of numbers $A, B, D$ with the following properties.

$A \cap B=\{3,8\}$

$A \cap D=\{8,9\}$

$B \cap D=\{8\}$

$A \cup B=\{1,2,3,4,8,9\}$

$A \cup D=\{1,2,3,5,6,7,8,9\}$

$B \cup D=\{3,4,5,6,7,8,9\}$

(2 points)

From the first three equalities, we conclude that the digit 6 is common to all sets. After that, it is easy to use Venn diagrams to determine the sets $A, B, D$.

![](https://cdn.mathpix.com/cropped/2024_06_03_ade005c4283eff439485g-04.jpg?height=558&width=626&top_left_y=1491&top_left_x=714)

(3 points)

Finally,

$$
A=\{1,2,3,8,9\}, \quad B=\{3,4,8\}, \quad D=\{5,6,7,8,9\}
$$

which means that Andrea thought of the number 12389, Barbara thought of the number 348, and Dora thought of the number 56789. (3 points)