A,B = map(int,input().split()) for i in rang(A,B+1): if i%3 == 0: print(i) else: s = str(i) if s.count("3") >= 1: print(s)