A, B = map(int, input().split()) for i in range(B-A+2): if (i + A) % 3 == 0: print(i+A) elif '3' in str(i+A): print(i+A) else: pass