A, B = map(int, input().split()) numc = list(range(A, B + 1)) for i in numc: if 29 < i < 40 or i % 3 == 0 or i % 10 == 3: print(i) else: pass