var n, p, i, j : longint;
f1, f2 : text;
function prostoe(n:longint): boolean;
var i, j : longint; t : boolean;
begin
j:=2; t:=true;
while t and (j*j<=n) do
begin
if n mod j=0 then t:=false;
j:=j+1
end;
prostoe:=t
end;
begin
assign(f1,'input.txt'); reset(f1);
assign(f2,'output.txt'); rewrite(f2);
read(f1,n);
while n>1 do
begin
p:=n+1;
while not prostoe(p) do p:=p+1;
i:=p-n; j:=n; n:=i-1;
while i<j do
begin
writeln(f2,i,' ',j);
i:=i+1; j:=j-1
end
end;
close(f2)
end.
f1, f2 : text;
function prostoe(n:longint): boolean;
var i, j : longint; t : boolean;
begin
j:=2; t:=true;
while t and (j*j<=n) do
begin
if n mod j=0 then t:=false;
j:=j+1
end;
prostoe:=t
end;
begin
assign(f1,'input.txt'); reset(f1);
assign(f2,'output.txt'); rewrite(f2);
read(f1,n);
while n>1 do
begin
p:=n+1;
while not prostoe(p) do p:=p+1;
i:=p-n; j:=n; n:=i-1;
while i<j do
begin
writeln(f2,i,' ',j);
i:=i+1; j:=j-1
end
end;
close(f2)
end.