#include using namespace std; static void setup() { cin.tie(0); ios::sync_with_stdio(false); } static void run() { int a, b; cin >> a >> b; for (auto n = a; n <= b; ++n) { if ((n % 3) != 0) { auto r = n; for (; r > 0 && (r % 10) != 3; r /= 10); if (r == 0) continue; } cout << n << endl; } } int main(int argc, char **argv) { setup(); run(); return 0; }