import sequtils, strutils iterator digits(x: int): int = var z = x while z > 0: yield z mod 10 z = z div 10 proc main() = var a, b: int (a, b) = stdin.readLine.split.map(parseInt) for i in a..b: if i mod 3 == 0: echo i elif toSeq(digits(i)).anyIt(it == 3): echo i when isMainModule: main()