a,b=gets.split(' ').map(&:to_i)
a.upto(b){|i|
  puts i if i%3==0||i.to_s=~/3/
}