#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c=0,temp=0;
cin>>a>>b;
for(int i=a;i<=b;i++){
c=0;
int p=0;
for(int j=2;j<i;j++){
if(i%j==0){
c=1;
}
}
if(c==0){
temp+=i%10*10;
temp+=i/10;
for(int f=2;f<i;f++){
if(i%f==0){
p=1;
}
}
if(p==0&&c==0){
cout<<i<<endl;
}
}
}
}