a,b = map(int,input().split()) for i in range(b-a+1): c = a+i if c%3 == 0: print(c) elif str(c).find("3") != -1: print(c)