using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Myon { static void Main() { string[] ss = Console.ReadLine().Split(' '); long a = long.Parse(ss[0]); long b = long.Parse(ss[1]); for (long i = a; i <= b; i++) { long t = i; bool ok = false; if (t % 3 == 0) ok = true; while (t != 0) { if (t % 10 == 3) ok = true; t /= 10; } if(ok) Console.WriteLine(i); } } }