import java.util.Scanner; public class Answer { public static void main(String str[]) { Scanner sc = new Scanner(System.in); int a = Integer.valueOf(sc.next()); int b = Integer.valueOf(sc.next()); for(int i=a ; i<= b; i++) { if(i % 3 == 0) { System.out.println(i); } else if(String.valueOf(i).contains("3")){ System.out.println(i); } } } }