program eightqueens(output);
a : array [ 1..8 ] of boolean;
b : array [ 2..16] of boolean;
c : array [-7..7 ] of boolean;
x : array [ 0..7 ] of integer;
writeln('*** Solution to the Eight Queens Problem ***');
write(tab, 9 - l : 1, ' ');
writeln(tab, ' q q q q k k k k');
writeln(tab, ' r n b b n r');
procedure trycol(j : integer);
begin a[i] := false; b[i+j] := false; c[i-j] := false;
begin a[i] := true; b[i+j] := true; c[i-j] := true;
repeat i := i+1; safe := a[i] and b[i+j] and c[i-j];
begin setqueen; x[j] := i;
if j < 8 then trycol(j+1) else print;
for i := 1 to 8 do a[i] := true;
for i := 2 to 16 do b[i] := true;
for i := -7 to 7 do c[i] := true;
writeln('No solutions!');