AB = list(map(int, input().split())) dat = list(range(AB[0], AB[1] + 1)) for i in dat: if i % 3 == 0 or '3' in str(i): print(i)