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