using System; namespace yukicoder { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int A = int.Parse(str[0]); int B = int.Parse(str[1]); for (int i=1;i<=B;i++) { string a = i.ToString(); string target = "3"; int ans = a.IndexOf(target, 0); if (A<=i&&B>=i) { if (i % 3 == 0) { Console.WriteLine(i); } else if (ans == 1 || ans == 0) { Console.WriteLine(i); } } } } } }