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