#include <bits/stdc++.h>   using namespace std;   int main() {     int y, l, r, x, rem;     cin >> l >> r;     for (x = l; x <= r; x++) {       y = x;       set<int> s;       while (y != 0) {         rem = y % 10;         if (s.find(rem) == s.end())           s.insert(rem);         else           break;         y /= 10;       }       if (y == 0) break;     }     if (y == 0)       cout << x;     else       cout << -1;     return 0;   }   