## Task A-4.5.

In a certain country, there are three cities $A, B$, and $C$. Between each pair of cities, there are several roads (at least one), and all roads are bidirectional. In addition to direct road connections between two cities, there are also indirect connections. An indirect road connection between cities $X$ and $Y$ consists of a road connecting city $X$ with a third city $Z$ and a road connecting cities $Z$ and $Y$.

It is known that there are a total of 43 road connections between cities $A$ and $B$, and a total of 29 road connections between cities $B$ and $C$. How many road connections can there be in total between cities $A$ and $C$?
## Solution.

Let $x$ be the number of roads between cities $B$ and $C$; $y$ be the number of roads between cities $C$ and $A$; $z$ be the number of roads between cities $A$ and $B$.

Then, for example, the number of indirect road connections between $A$ and $C$ (via $B$) is equal to $z \cdot x$.

Now we can write the condition of the problem in the form of two equations:

$$
\begin{aligned}
& x y + z = 43 \\
& y z + x = 29
\end{aligned}
$$

By subtracting these equations, we get $x y - y z + z - x = 43 - 29$ or

$$
(x - z)(y - 1) = 14
$$

Since $x, y, z$ are natural numbers, we get four possibilities:
$x - z = 14$
$x - z = 7$
$x - z = 2$
$x - z = 1$
$y - 1 = 1$
$y - 1 = 2$
$y - 1 = 7$
$y - 1 = 14$

which further gives us

$y = 2$

$y = 3$

$y = 8$

$y = 15$

2 points

Using $x y + z = 43$, we get the systems
$x - z = 14$
$x - z = 7$
$x - z = 2$
$x - z = 1$
$2 x + z = 43$
$3 x + z = 43$
$8 x + z = 43$
$15 x + z = 43$

In the first case, $x = 19, y = 2, z = 5$, and in the third case, $x = 5, y = 8, z = 3$. In the remaining two cases, the solutions are not integers.

The total number of road lines between $A$ and $C$ is equal to $x z + y$, so it can be 97 or 23.