#include
using namespace std;
int n,a,mx = -1e6,b[10101];
bool check(int x) {
for (int i = 2; i
if (x % i == 0) return 0;
return 1;
}
main () {
cin >>n;
for (int i = 1; i
{
cin >>b[i];
mx = max(mx,b[i]);
}
for (int i = 1; i
if (check(b[i])) b[i] = mx;
for (int i = 1; i
cout
}