let main = (standardInput) => {
    var line = standardInput.split(" ");
    var min = Number(line[0]);
    var max = Number(line[1]);
    for (var i = min; i < max; i++) {
        if (i % 3 === 0 ) {
            var array = i;
            console.log(array);
        } else if(i.toString().indexOf("3") !== -1){
            array = i;
            console.log(array);
        }
    }
};
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));