a,b=gets.split;(a..b).each{|i|puts i if i.to_i%3<1||i[/3/]}