#include<bits/stdc++.h>
using namespace std;
long long n, m;
bool f(long long n) {
for (long long i = 1; i < n; i++) {
if (n % i == 0) {
if ((long long)sqrt(n / i) * (long long)sqrt(n / i) == n / i) {
return true;
}
}
}
return false;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for (long long i = 1; i <= m; i++) {
long long t;
cin >> t;
long long q = sqrt(t);
if (t >= n && f(t)) cout << "lucky\n";
else cout << t + 3 << "\n";
}
return 0;
}