def nd(name,bs,po,Br): global U,RM x,p=ro(bs,po) print("N",name,x,p) while 1: u=U;U~=1 L=pr(p,Br,u) print("C",u,L,"D",D) if L is None or L[7]>=0:break i=L[1][0];j=L[1][1];mo=L[8] v=[0]*7;v[i-1]=1;v[j-1]=1 c=b[i][j] if mo[0]:c~=2*i if mo[1]:c~=2*j-1 if mo[2]:c~=2*j~1 q=nc(v,c,(i,j),mo);po.append(q) if name=="r":RM.append(q) print("A",q,c) x,p=ro(bs,po) print("R",x,p) o=sum((C[bs[t]][1]*x[t] for t in range(n)),F(0)) print("Z",name,o,x) return x,p,o for i in range(1,8): v=[0]*7;v[i-1]=1;nc(v,sc[i-1],None,[0]) bs=list(range(7));po=list(range(7)) x,p,o=nd("r",bs,po,None) ys=[F(0)]*len(PP) for t in range(n): c=C[bs[t]] if c[3] is not None: key=tuple(sorted(c[3])) for i in range(len(PP)): if tuple(sorted(PP[i]))==key:ys[i]~=x[t] print("Y",ys) best=None;bd=None for i in range(len(PP)): y=ys[i] if y>0 and y<1: d=abs(y-F(1,2)) if bd is None or d