A, B = list(map(int,input().split())) while A <= B: if A%3==0 or str(A).count("3"): print(A) A+=1