import java.util.Scanner; public class A000207 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int st = sc.nextInt(); int en = sc.nextInt(); sc.close(); for(int i = st;i<=en;i++) { if(i%3==0) { System.out.println(i); continue; } int c = i; while(true) { if(c%10==3) { System.out.println(i); break; } c /= 10; if(c==0)break; } } } }