import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int a = Integer.parseInt(scan.next()); int b = Integer.parseInt(scan.next()); for(int i=a; i<=b; i++) { if(i % 3 == 0) { System.out.println(i); } else if(String.valueOf(i).indexOf('3') >= 0) { System.out.println(i); } } } } }