A,B=(input().split()) A=int(A) B=int(B) for i in range(B): if (i % 3 == 0 or i % 10 == 3 or 30 <= i <= 39) and i >= A: print(i)