#include<bits/stdc++.h>
using namespace std;
int main(){
int a,n;
cin>>a>>n;
for(int i=0;i<n;i++){
int k;
cin>>k;
double x;
x=sqrt(k);
if(x-int(x)==0&&k>=a){
cout<<"lucky"<<endl;
}
else{
bool f1=false;
for(int j=2;j*j<=k;j++){
if(k%(j*j)==0&&j*j*(k/j)>=a){
f1=true;
break;
}
}
if(f1){
cout<<"lucky"<<endl;
}else{
if(k<a){
k=a;
}
while(true){
bool y=false;
x=sqrt(k);
if(x-int(x)==0){
cout<<k<<endl;
break;
} else{
for(int j=2;j*j<k;j++){
if(k%(j*j)==0){
cout<<k<<endl;
y=true;
break;
}
}
}
if(y){
break;
}
k++;
}
}
}
}
}