using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using static System.Console; using static System.Math; namespace CP { class Atria { static void Main(string[] args) { int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray(); for (int i = s[0]; i <= s[1]; i++) { if (EachDigit(i) || i % 3 == 0) { WriteLine(i); } } } static bool EachDigit(long x) { if (x == 0) return false; if (x % 10 == 3) return true; return EachDigit(x / 10); } } }