#include using namespace std; #define ll long long #define FOR(i, m, n) for(int i = m; i < n; i++) bool f(ll n) { while (n > 0) { if (n % 10 == 3) return true; n /= 10; } } int main() { ios::sync_with_stdio(false); cout.tie(0); ll a, b; cin >> a >> b; FOR(i, a, b + 1) { if (f(i) || i % 3 == 0) cout << i << endl; } return 0; }