import java.io.IOException; import java.util.Scanner; public class No00000207_Main { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); for(int i = a; i <= b; i++) { if(i % 3 == 0 || with3(String.valueOf(i))) { System.out.println(i); } } scan.close(); } private static boolean with3(String str) { for(int i = 0; i < str.length(); i++) { if(str.charAt(i) == '3') { return true; } } return false; } }