const input = require('fs').readFileSync('/dev/stdin', 'utf8'); const arr = input.split(' '); let A = parseInt(arr[0]); let B = parseInt(arr[1]); let reg = new RegExp() for(let i = A; i <= B; i++) { //console.log(i + '\n'); if(i % 3 === 0) { //console.log(i + '\n'); //console.log(String(i)); } if ((i % 3 === 0) || String(i).indexOf("3") !== -1) { console.log(i + '\n'); //console.log('if文に入りました'); } }