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(i%3==0){ continue; }else if(String.valueOf(i).contains("3")){ continue; } out.println(i); } out.flush(); } }