Once, Tanya was traveling by train. To avoid boredom, she started to encrypt the names of different cities by replacing the letters with their ordinal numbers in the alphabet. When Tanya encrypted the departure and arrival points of the train, she was surprised to find that they were written using only two digits: 21221-211221. Where did the train come from and where was it going?

#
Note: The name of the city from which the train departed can only consist of letters with numbers $1, 2, 11$, $12, 21, 22$.

## Solution

Let's demonstrate the reasoning process using the decoding of the first city's name as an example:

1. The first letter is either Б (2) or У (21).
2. Options for the second letters: БА (21), БК (212), УБ (212), УФА (21221). Thus, a possible answer is УФА (Ufa). Let's check if there are any others.
3. Options for the third letters: БАБ (212), БАФА (21221), БКБА (21221), БКУ (21221), УБУ (21221), УББА (21221).
4. Further options: БАББА, БАБУ.

Thus, we have determined that the train is coming from Ufa, and you can determine the destination city yourself by reasoning similarly. The destination should be the city named BAKU.

## Answer

Ufa - Baku.