A, B = map( int, input().split() ) N = B - A for i in range(N): X = A + i Number = str(X) if X % 3 == 0 or Number.find('3') > -1: print(X)