#include #include #include using namespace std; int main() { int A, B; cin >> A >> B; for (int i = A; i <= B; i++) { bool ok = false; if (i % 3 == 0) ok = true; for (int t = i; t > 0; t /= 10) { if (t % 10 == 3) ok = true; } if (ok) cout << i << endl; } return 0; }