a,b=map(int,input().split()) c=b-a for i in range(c): d=a+i strd=str(d) if d % 3==0: print(d) elif strd.find("3")>0: print(d) else: pass