#include #include using namespace std; typedef long long int lint; bool threeQ(lint n) { while (n != 0) { if (n % 10 == 3) return true; n /= 10; } return false; } int main() { lint A, B; cin >> A >> B; for (lint i = A; i <= B; i++) if (i % 3 == 0 || threeQ(i)) cout << i << endl; return 0; }