#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
const int MAX = 1000000;
bool check[MAX+1];
int main() {
FASTIO;
check[0] = check[1] = true;
for (int i=2; i*i<=MAX; i++) {
if (check[i] == false) {
for (int j=i+i; j<=MAX; j+=i) {
check[j] = true;
}
}
}
int m, n;
cin >> m >> n;
for (int i=m; i<=n; i++) {
if (check[i] == false) {
cout << i << '\n';
}
}
return 0;
}