using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace template { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); for (int i = x[0]; i <= x[1]; i++) { bool flag = false; string s = i.ToString(); for (int j = 0; j < s.Length; j++) if (s[j] == '3') flag = true; if (flag || i % 3 == 0) Console.WriteLine(i); } } } }