x = list(map(int, input().split())) for i in range(x[0], x[1]): if "3" in str(i): print(i) elif 0 == i % 3: print(i)