import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000207_Main3 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] arr = br.readLine().split(" "); for(int i = Integer.parseInt(arr[0]); i <= Integer.parseInt(arr[1]); i++) { if(i % 3 == 0 || String.valueOf(i).contains("3")) { System.out.println(i); } } } }