def all_prime_factors(p: int) -> list:
    """
    Returns a list of distinct
    prime factors of the number p
    """
    factors = []
    loop = 2
    while loop <= p:
        if p % loop == 0:
            p //= loop
            factors.append(loop)
        else:
            loop += 1
    return factors