def initChess(a, n): # 1 It's white chess 2 It's black chess
for i in range(n):
a[i] = 1
for i in range(n, n * 2):
a[i] = 2
a[n * 2] = 0
a[n * 2 + 1] = 0
def move(a, m, n):
a[n] = a[m]
a[m] = 0
def chess(a, n):
if n == 1:
move(a, 0, 2)
move(a, 1, 3)
return
move(a, n - 1, n * 2)
move(a, n, n * 2 + 1)
move(a, n * 2 - 1, n - 1)
move(a, n * 2 - 2, n)
chess(a, n - 1)
n = 4
a = [0] * ((n + 1) * 2)
initChess(a, n)
chess(a, n)
print(a)