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