a,b = map(int,input().split())
for i in range(a,b+1):
    m = (i%3 == 0)
    for l in range(8):
        m = m|(i//10**l%10 == 3)
    print(i) if m else i