a, b = map(int, input().split()) for num in range(a, b + 1): if "3" in str(num) or num % 3 == 0: print(num)