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