import java.util.Scanner; public class No_207 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int beginningNum = sc.nextInt(); int endNum = sc.nextInt(); String bn = String.valueOf(beginningNum); while(beginningNum <= endNum){ if(beginningNum%3 == 0){ System.out.println(beginningNum); } else if(bn.indexOf('3') != -1){ System.out.println(beginningNum); } bn = String.valueOf(++beginningNum); } } }