//No.207 世界のなんとか //http://yukicoder.me/problems/560 //20170417 1636 package no207; import java.util.Scanner; public class No207 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a; int b; int num; a = scan.nextInt(); b = scan.nextInt(); scan.close(); for(int i = a; i <= b; i++){ if(i % 3 == 0) { System.out.println(i); } else { num = i; while(num > 0){ if(num % 10 == 3) { System.out.println(i); num = 0; } else { num /= 10; } } } } } }