a, b = map(int, input().split()) c = [i for i in range(a, b+1)] d =[] for i in c: if i % 3 == 0: d.append(i) elif '3' in str(i): d.append(i) print(d)