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