2. An eight-digit natural number $A$, written in the decimal system, is obtained from the number $B$ by swapping the last digit to the first place. It is known that the number $B$ is coprime with the number 12 and $B>4444444$. Find the largest and smallest among the numbers $A$ that satisfy these conditions. (Two natural numbers are called coprime if they have no common divisors other than one). (8 points)
Solution. Obviously, the last digit of the number $B$ cannot be zero, since when rearranged, it becomes the first digit of the number $A$. $B=2^{2} \cdot 3$, so the number $B$ will be coprime with 12 if and only if it is not divisible by 2 or 3.

If $b$ is the last digit of the number $B$, then the number $A=10^{7} \cdot b + \frac{1}{10} \cdot (B - b)$ (it is clear that $B - b$ is divisible by 10).

Obviously, the larger the last digit of the number $B$, the larger the corresponding number $A$. To make $A$ the largest, the last digit of the number $B$ must take the largest possible value, i.e., $b=9$.

If $B'$ and $B$ end in 9 and $B' > B$, then

$$
A' = 9 \cdot 10^{7} + \frac{1}{10} \cdot (B' - 9) > 9 \cdot 10^{7} + \frac{1}{10} \cdot (B - 9) = A
$$

This means that the larger the number $B$, the larger the corresponding number $A$ (for numbers $B$ ending in 9).

The largest possible value of $B$ is 99999999. This number is not divisible by 2, but it is divisible by 3. By reducing the second-to-last digit by 1, we get $B = 999999989$. This number satisfies all conditions: it ends in 9, is coprime with 12, and is the largest among all such numbers. Therefore, it corresponds to the largest possible number $A_{\max} = 999999998$.

Similarly, the smallest number is determined: the first digit of $A$ (i.e., the last digit of $B$) must be the smallest possible, so $b=1$. Among the numbers $B$ ending in 1, the smallest $A$ corresponds to the smallest $B$. If the last digit is 1, the smallest number that satisfies the inequality $B > 44444444$ is 44444451. However, it is divisible by 3, as the sum of the digits is 30. By changing the second-to-last digit to 1, we get the number $B = 44444461$, which satisfies all conditions: it ends in 1, is coprime with 12, and is the smallest among all such numbers. It corresponds to the smallest possible number $A_{\text{min}} = 14444446$.

Answer. $A_{\min} = 14444446, A_{\max} = 99999998$