#include using namespace std; int main() { freopen("cloprime.inp","r",stdin); freopen("cloprime.out","w",stdout); bool check[1000000]; for (int i=2;i<=1000000;i++){ check[i]=true; } check[0]=false;check[1]=false; for (int i=2;i<=1000000;i++){ if (check[i]==true){ for (int j=2*i;j<=1000000;j+=i){ check[j]=false; } } } long long n;cin>>n; long long x; for(int i=1;i<=n;i++){ cin>>x; while(check[x]==false) x--; cout<