import java.io.PrintWriter; import java.util.*; public class No0207 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int a = scanner.nextInt(); int b = scanner.nextInt(); for(int i = a; i <= b; i++) { if (Integer.toString(i).contains("3")) { out.println(i); continue; } else if (i % 3 == 0) { out.println(i); continue; } out.println(i); } out.flush(); } }