a,b = map(int, input().split()) def calc(a,b): l=[] for i in range(a,b+1): if i%3==0: l.append(i) continue m=i while 1: if m==0: break if ((m-round(m,-1))==3): l.append(i) break m=int(m/10) return l for i in calc(a,b): print(i)