A,B = map(int,input().split()) def nabeatsu(x): for n in range(0,10): if (x//(10**n))%10-3 == 0 or x%3 == 0: return True else: return False for i in range(A,B+1): if nabeatsu(i) == True: print(i)