#include<bits/stdc++.h>
using namespace std;
int a,b;
bool zhi(int x)
{
int m=0;
for(int i=1;i<=x;i++)
if(x%i==0)
m++;
if(m==2)
return true;
else
return false;
}
int main()
{
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(zhi(i))
{
int e[11],n=0,m=0,p=i;
while(p>0)
{
e[n]=p%10;
p/=10;
n++;
}
if(n>2&&n%2==0)
continue;
for(int l=0,j=n-1;l<=n-1,j>=0;l++,j--)
m+=e[l]*pow(10,j);
if(m==i)
cout<<i<<endl;
}
}
return 0;
}