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