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