a,b = input().split() i = int(a) N = int(b) while i <= N: if i%3==0: print(i) elif str(3) in str(i): print(i) i += 1