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