a,b=map(int,input().split()) [print(n) for n in range(a,b+1) if n%3==0 or '3' in str(n)]