def chain(number: int) -> bool:

    if CHAINS[number - 1] is not None:
        return CHAINS[number - 1]  # type: ignore

    number_chain = chain(next_number(number))
    CHAINS[number - 1] = number_chain

    while number < 10000000:
        CHAINS[number - 1] = number_chain
        number *= 10

    return number_chain