A,B = map(int,input().split()) list_AB = range(A,B) for i in list_AB: if i % 3 == 0: print(i) elif i.count("3") > 0: print(i)