#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define lli long long int using namespace std; bool isDiv3(lli n) { while (n > 0) { if ((n % 10) == 3) { return true; } n /= 10; } return false; } int main() { fastIO; lli a, b; cin >> a >> b; for (lli i = a; i <= b; ++i) { if (i % 3 == 0 || isDiv3(i)) { cout << i << '\n'; } } return 0; }