a,b = map(int,input().split()) for i in range(a,b+1): print(i) if (i%3 == 0)|(i%10 == 3)|(i//10%10 == 3)|(i//100%10 == 3)|(i//1000%10 == 3)|(i//10000%10 == 3)|(i//10**5%10 == 3)|(i//10**6%10 == 3)|(i//10**7%10 == 3)|(i//10**8%10 == 3) else i