// 问题:[l,r] 区间满足偶然对消 a/b=1/2 的数据按照分子分母升序排序后输出
// sol:枚举 a, 计算 b=2*a, 判断 (a,b) 是否满足偶然对消,整体复杂度 O(nlogn) , n=10^6
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){ return b?gcd(b,a%b) : a; }
bool cal(int a,int b){
    vector<int> va,vb;
    map<int,int> ha, hb;
    int t=a;
    while(t) ha[t%10] ++, va.push_back(t%10), t/=10;
    t=b;
    while(t) hb[t%10] ++, vb.push_back(t%10), t/=10;
    reverse(va.begin(), va.end()), reverse(vb.begin(), vb.end());
    for(int i=0; i<va.size(); i++){
        int& x = va[i];
        if(hb[x]) hb[x] --, x=-1;
    }
    for(int i=0; i<vb.size(); i++){
        int& x = vb[i];
        if(ha[x]) ha[x] --, x=-1;
    }
    // for(auto u:va) cout<<u; cout<<endl;
    // for(auto u:vb) cout<<u; cout<<endl;
    int p=0, q=0;
    for(int i=0; i<va.size(); i++) if(va[i] != -1) p=p*10+va[i];
    for(int i=0; i<vb.size(); i++) if(vb[i] != -1) q=q*10+vb[i];
    // cout<<p<<" "<<q<<endl;
    if(p==0 || q==0) p=q=1; 
    return (p==1 && q==2);
}
int main(){
    int l,r,f=0; cin>>l>>r;
    for(int i=l; i<=r; i++){
        int j=2*i, t = cal(i,j); 
        if(t) cout<<i<<" "<<j<<endl, f=1;
    }
    if(!f) cout<<-1;
    return 0;
}