#include <bits/stdc++.h>
using namespace std;
long long zs(long long x) {
if(x == 1)
return 0;
if(x == 2)
return 1;
for (long long i = 2; i < x; i++)
if(x % i == 0)
return 0;
return 1;
}
int main() {
long long s, m, n, a, b;
scanf("%lld%lld", &m, &n);
for (s = m; s <= n; s++) {
a = s / 100;
b = s / 10;
if(zs(s) == 1 && zs(a) == 1 && zs(b) == 1)
printf("%lld\n", s);
}
return 0;
}