using System; public class Test { public static bool isOk (long value) { if (value % 3 == 0) { return true; } while (value > 0) { if (value % 10 == 3) { return true; } value /= 10; } return false; } public static void Main(string[] args) { string[] nums = Console.ReadLine().Split(' '); long min = long.Parse(nums[0]); // min >= 1 long max = long.Parse(nums[1]); for (long i = min; i <= max; i++) { if (isOk(i)) { Console.WriteLine(i); } } } }