first = input() split_first = first.split() a = int(split_first[0]) b = int(split_first[1]) for i in range(b-a+1): c = a+i if (c) % 3 == 0: print(c) elif "3" in str(c): print(c)