import re (A,B)=map(int,input().split()) for i in range(A,B+1): if re.search(r"3",str(i))!=None or i%3==0: print(i)