l = [int(i) for i in input().split()] for i in range(l[0],l[1] + 1): if i % 3 == 0: print(i) else: z = i while z > 0: if z % 10 == 3: print(i) break z = z // 10