fun main() {val(m,x)=readLine()!!.split(" ").map{it.toInt()} (m..x).filter{it%3==0||'3' in it.toString()}.forEach{println(it)}}