import java.util.Scanner; public class Main{ public static void main(String[] args) { //System.out.println("最小値"); Scanner scanner = new Scanner(System.in); int A = scanner.nextInt(); //System.out.println("最大値"); int B = scanner.nextInt(); scanner.close(); int n = B-A; //調べる数字の数n int k = A; //調べる数字 for(int i=0; i < n; i++) { int digits_k = (int)(Math.log10(k))+1; if(k % 3 == 0) { System.out.println(k); k ++; }else { int k_d1 = k; int k_d2 = k/10; for(int j=0; j < digits_k; j++) { int k_d_j = k_d1 - k_d2*10; if(k_d_j == 3) { System.out.println(k); break; }else { k_d1 = k_d1/10; k_d2 = k_d2/10; } } k++; } } } }