Program gt;
label 1,2;
var a,b:array[1..1000]of integer;
n,i,l,j:integer;
begin
read(n);
for i:=1 to n do
begin
read(a[i]);
l:=round(sqrt(a[i]));
for j:=2 to l do
begin
if(a[i] mod j=0)then goto 1;
end;
b[i]:=a[i];
goto 2;
1:
b[i]:=j;
2:
end;
for i:=1 to n do
begin
write(a[i],' ',b[i],' ');
end;
end.