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