static bool IsSu(int number)
{
bool isSu = true;
for (int j = 2; j < number ; j++)
{
if (number % j == 0)
{
isSu = false;
break;
}
}
return isSu;
}
static void Main(string[] args)
{
string str = Console.ReadLine();
string[] strArray = str.Split(' ');
int[] intArray = new int[strArray.Length];
for (int i = 0; i < strArray.Length; i++)
{
int number1 = Convert.ToInt32(strArray[i]);
intArray[i] = number1;
}
int m = intArray[0];
int n = intArray[1];
for (int i = m; i < n+1; i++)
{
bool isSu = IsSu(i);
if (isSu)
{
int temp = i;
int number = 0;
while (temp % 10 != 0)
{
number = number * 10 + temp % 10;
temp = temp / 10;
}
bool isSuFan = IsSu(number);
if (isSuFan == true)
{
Console.Write(i + " ");
}
}
}