#include using namespace std; const int MAXA = 2e9; const int MAXB = 2e9; const int MAXA_B = 100; bool has3(int x){ while( x > 0 ){ if( x % 10 == 3 ) return true; x /= 10; } return false; } int main(){ int a, b; scanf("%d %d", &a, &b); for(int i = a; i <= b; ++i){ if( i % 3 != 0 && !has3( i ) ) continue; printf("%d\n", i); } return 0; }