A,B=map(int,input().split()) for i in range(A,B+1): if i%3==0: print(i) else: c=i d=i while d>1: if d%10==3: print(c) d=d//10 else: d=d//10