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