"""Numbers with exactly three prime factors, not all of them distinct (n < 1000)"""

import collections

def smallest_prime_factor(n):
    for divisor in range(2, n):
        if n % divisor == 0:
            return divisor
    return n

def get_prime_factors(n):
    primeFactors = collections.Counter()

    while True:
        smallestPrimeFactor = smallest_prime_factor(n)
        if smallestPrimeFactor == 1:
            break
        n = int(n / smallestPrimeFactor)
        primeFactors[smallestPrimeFactor] += 1

    return primeFactors

def main():
    sequence = []

    for n in range(1, 1000):
        primeFactors = get_prime_factors(n)
        uniquePrimeFactorCounts = sorted(primeFactors.values())
        if uniquePrimeFactorCounts in ([3], [1, 2]):
            sequence.append(n)

    print(",".join(str(n) for n in sequence))

if __name__ == "__main__":
    main()