s,e=map(int,input().split()) for i in range(s,e): if i%3==0: print(i) else: sti=str(i) for j in range(len(sti)): if sti[j]=="3": print(i)