#include <iostream>
using namespace std;
int main() {
int x, y; // границы поиска
cin >> x >> y;
for (int i = x; i < y + 1; i++){
int a = i / 1000; // цифры
int b = (i / 100) % 10;
int c = (i / 10) % 10;
int d = i % 10;
if ( (a != b) && (a != c) // проверка разности
&& (a != d) && (b != c)
&& (b != d) && (c != d) )
cout << i << ' ';
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CQkKCWludCB4LCB5OwkJCQkJCQkJLy8g0LPRgNCw0L3QuNGG0Ysg0L/QvtC40YHQutCwCgljaW4gPj4geCA+PiB5OwkJCQkJCQkKCWZvciAoaW50IGkgPSB4OyBpIDwgeSArIDE7IGkrKyl7CgkJaW50IGEgPSBpIC8gMTAwMDsJCQkJCS8vINGG0LjRhNGA0YsgCgkJaW50IGIgPSAoaSAvIDEwMCkgJSAxMDsKCQlpbnQgYyA9IChpIC8gMTApICUgMTA7CgkJaW50IGQgPSBpICUgMTA7CgkJaWYgKCAoYSAhPSBiKSAmJiAoYSAhPSBjKQkJCS8vINC/0YDQvtCy0LXRgNC60LAg0YDQsNC30L3QvtGB0YLQuAoJCSYmIChhICE9IGQpICYmIChiICE9IGMpCgkJJiYgKGIgIT0gZCkgJiYgKGMgIT0gZCkgKQoJCQljb3V0IDw8IGkgPDwgJyAnOwoJfQoJcmV0dXJuIDA7Cn0=