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