#include typedef long long ll; const int INF = 1e9; const ll LINF = 1e18; const int MOD = 1e9 + 7; using namespace std; bool check(int x) { if (x % 3 == 0) return true; while (x > 0) { if (x % 10 == 3) return true; x /= 10; } return false; } int main() { int a, b; cin >> a >> b; for (int i = a; i <= b; i++) { if (check(i)) cout << i << endl; } }