#include <iostream>
#include <cmath>
using namespace std;
bool isp(int n)
{
if (n < 2)
return 0;
for (int i = 2; i <= sqrt(n); i++)
if (n % i == 0)
return 0;
return 1;
}
int geth(int n)
{
int m = 0;
while (n)
{
m = m * 10 + n % 10;
n /= 10;
}
return m;
}
int main()
{
int m, n;
cin >> m >> n;
bool f = 1;
for (int i = m; i <= n; i++)
{
if (isp(i) && isp(geth(i)))
{
if (f)
{
cout << i;
f = 0;
}
else
cout << "," << i;
}
}
if (f)
cout << "No";
return 0;
}