def include3(n): if n%3==0: return True if "3" in str(n): return True return False n1, n2 = map(int, input().split()) for n in range(n1, n2+1): if include3(n): print(n)