def nqueens():
for i in range(100):
a = [0] * 9
r = 8
s = 0
x = 0
y = 0
t = 0
while True:
x += 1
a[x] = r
while True:
s += 1
y = x
while y>1:
y -= 1
t = a[x]-a[y]
if t==0 or x-y==abs(t):
y=0
a[x] -= 1
while a[x]==0:
x -= 1
a[x] -= 1
if y==1:
break;
if x==r:
break;
print(s)