import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int num = a; if(a % 3 == 1) num += 2; if(a % 3 == 2) num += 1; while (num <= b) { if(num % 3 == 0) { System.out.println(num); } else { String s = String.valueOf(num); for(int i = 0; i < s.length(); i++) if(s.charAt(i) == '3') { System.out.println(num); break; } } ++num; } } }