#include using namespace std; int judge( int i ) { if( i % 3 == 0 ) return 1; while( i != 0 ) { if( i % 10 == 3 ) return 1; i /= 10; } return 0; } int main() { int a = 0; int b = 0; cin >> a >> b; for( int i = a; i <= b; i++ ) { if( judge( i ) ) cout << i << endl; } return 0; }