#include #define REP(i,n) for(int i=0; i<(n); i++) #define REP2(i,x,n) for(int i=x; i<(n); i++) using namespace std; struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww; int main() { int A, B; cin >> A >> B; for( int i = A; i<= B; i++ ) { string N = to_string( i ); if( i % 3 == 0 ) { cout << i << endl; } else if( N.find('3') != string::npos ) { cout << i << endl; } } return 0; }