a,b=map(int,input().split()) n=list(range(a,int(b+1))) for x in n: if x %3 ==0: print(x) else: x=str(x) y=list(x) #print(y) if '3' in y: print(x)