#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) const int mod=1000000007; bool dec(ll a){ while(a>0){ if(a%10==3) return true; a/=10; } return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll a,b;cin >> a >> b; for(ll i=a;i<=b;++i){ if(i%3==0 || dec(i)) cout << i << endl; } }