program Project1;
const max=10000;
type arr=array[1..max]of integer;
var a:arr; n:integer;
procedure aqueen(n:integer);
var i,j,k,total:integer;
begin
total:=0;
for i:=1 to n do a:=1;
i:=1;
while true do
begin
if (a<=n) then
begin
k:=1;
while (k<=i-1)and ((a-a[k])*(abs(a-a[k])-abs(i-k))<>0) do
k:=k+1;
if k<=i-1 then begin inc(a); continue; end;
inc(i);
if (i<=n) then continue;
inc(total); write(total:5,':');
for j:=1 to n do write(a[j]:5); writeln;
inc(a[n]); i:=n; continue;
end
else
begin
a:=1; i:=i-1;
if i<1 then break;
inc(a); continue;
end;
end;
end;
begin
readln(n);
aqueen(n);
readln;
end.