import std.stdio; import std.algorithm; import std.conv; void main() { int[2] input; readln.splitter.map!(to!int).copy(input[]); foreach (i; input[0]..(input[1] + 1)) { if (i % 3 == 0 || i % 10 == 3) { writeln(i); } else { for (long j = 1000000000, x = i; j < i; x %= j, j /= 10) { if (x / j == 3) { writeln(i); break; } } } } }