# coding: utf-8 # Here your code ! x,y=[int(i) for i in input().split()] for i in range(x,y): a = int(i / 10) b = i - a * 10 #print(a) #print(b) if i % 3 == 0 or a == 3 or b == 3 : print(i)