import java.util.Scanner; public class WorldOfNabeatsu { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int E = B - A + 1; int[] L = new int[E]; int[] temporaryStorage = new int[E]; for(int i = 0;i < E;i ++){ L[i] = A; A ++; } String[] str = new String[E]; for(int i = 0;i < E;i ++){ str[i] = String.valueOf(L[i]); } for(int i = 0; i < E ; i++){ if(L[i] % 3 == 0){ System.out.println(L[i]); }else if(str[i].indexOf("3") >= 0){ System.out.println(L[i]); } } } }