using namespace std;
int n=0,p,q;
bool visited[10];
int data[100000],indexxx=0;
bool dfs_try(int depth,int amount){
if (depth==n){
bool isok=true;
for (int i=p;i<=q;i++)
if (amount%i!=0){
isok=false;
break;
}
if (isok)
data[indexxx++]=amount;
return isok;
}
bool isok=false;
for (int i=1;i<10;i++)
if (!visited[i]){
visited[i]=true;
if (dfs_try(depth+1,amount*10+i)) isok=true;
visited[i]=false;
}
return isok;
}
int main (void){
indexxx=n=0;
int m;
for (int i=0;i<10;i++)
visited[i]=true;
//memset(visited,true,sizeof(visited));
cin>>m>>p>>q;
while (m){
n++;
visited[m%10]=false;
m/=10;
}
if (!dfs_try(0,0))
cout<<"No answer";
else{
//cout<<indexxx<<endl;
for (int i=0;i<indexxx;i++){
if (i!=0) cout<<endl;
cout<<data[i];
}
}
//while(1);
return 0;
}
/*
132
1 3
===
*/