program prvizad;
var
a:integer;
s:string;
begin
readln(a);
s:=' ';
if a = 2 then
begin
writeln(4,s,1);
writeln(3,s,2);
end;
if a = 3 then
begin
writeln(6,s,1,s,5);
writeln(4,s,2,s,3);
end;
if a = 4 then
begin
writeln(8,s,1,s,7,s,2);
writeln(6,s,3,s,5,s,4);
end;
if a = 5 then
begin
writeln(10,s,1,s,9,s,2,s,9);
writeln(7,s,3,s,6,s,4,s,5);
end;
end.