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