import java.util.*; public class Main { public static void main(String[] args) { int o,p,q; Scanner sc = new Scanner(System.in); int[] test = new int[100000]; int[] test2 = new int[100000]; // String str = sc.next(); int s = Integer.parseInt(sc.next()); int t = Integer.parseInt(sc.next()); for(int a = s ; t > a ; a++) { if( a % 3 == 0 ) System.out.println(a); else if( a % 10 == 3 ) System.out.println(a); } /* while(true){ if( s /t < t ) o++; else break; } System.out.println(o); /* while(true){ int s = Integer.parseInt(sc.next()); int t = Integer.parseInt(sc.next()); if( s == 0 && t == 0 ) break; test [d] = s ; test2 [d] = t ; d++; } */ System.out.println(); } }