A,B = map(int,input().split()) for i in [x for x in range(A,B + 1) if not x % 3 or x % 10 == 3]: print(i)