def numbers_other():
    for i in range(1001):
        if i % 3 == 0:
            if i % 5 != 0:
                j = len( str(i) )
                sum = 0
                while j != 0 and sum < 10:
                    sum += int( str(i)[j-1] )
                    j -= 1
                if sum < 10:
                    print(i, end=" ")

numbers_other()
# your code goes here