#include using namespace std; bool is3num(long long a) { long long tmp; tmp = a; while (tmp != 0) { if (tmp % 10 == 3) { return true; } tmp /= 10; } return false; } int main() { long long a, b; cin >> a >> b; for (long long i = a; i <= b; i++) { if (i % 3 == 0 || is3num(i)) { cout << i << endl; } } return 0; }