Path: blob/master/src/sage/combinat/designs/steiner_quadruple_systems.py
8818 views
r"""1Steiner Quadruple Systems23A Steiner Quadruple System on `n` points is a family `SQS_n \subset \binom {[n]}44` of `4`-sets, such that any set `S\subset [n]` of size three is a subset of5exactly one member of `SQS_n`.67This module implements Haim Hanani's constructive proof that a Steiner Quadruple8System exists if and only if `n\equiv 2,4 \pmod 6`. Hanani's proof consists in 69different constructions that build a large Steiner Quadruple System from a smaller10one, and though it does not give a very clear understanding of why it works (to say the11least)... it does !1213The constructions have been implemented while reading two papers simultaneously,14for one of them sometimes provides the informations that the other one does15not. The first one is Haim Hanani's original paper [Hanani60]_, and the other16one is a paper from Horan and Hurlbert which goes through all constructions17[HH12]_.1819It can be used through the ``designs`` object::2021sage: designs.steiner_quadruple_system(8)22((0, 1, 2, 3), (0, 1, 6, 7), (0, 5, 2, 7), (0, 5, 6, 3), (4, 1, 2, 7),23(4, 1, 6, 3), (4, 5, 2, 3), (4, 5, 6, 7), (0, 1, 4, 5), (0, 2, 4, 6),24(0, 3, 4, 7), (1, 2, 5, 6), (1, 3, 5, 7), (2, 3, 6, 7))2526REFERENCES:2728.. [Hanani60] Haim Hanani,29On quadruple systems,30pages 145--157, vol. 12,31Canadadian Journal of Mathematics,32196033http://cms.math.ca/cjm/v12/cjm1960v12.0145-0157.pdf3435.. [HH12] Victoria Horan and Glenn Hurlbert,36Overlap Cycles for Steiner Quadruple Systems,372012,38http://arxiv.org/abs/1204.32153940AUTHORS:4142- Nathann Cohen (May 2013, while listening to "*Le Blues Du Pauvre Delahaye*")4344Index45-----4647This module's main function is the following :4849.. csv-table::50:class: contentstable51:widths: 15, 20, 6552:delim: |5354| :func:`steiner_quadruple_system` | Returns a Steiner Quadruple System on `n` points5556This function redistributes its work among 6 constructions :5758.. csv-table::59:class: contentstable60:widths: 15, 20, 6561:delim: |6263Construction `1` | :func:`two_n` | Returns a Steiner Quadruple System on `2n` points64Construction `2` | :func:`three_n_minus_two` | Returns a Steiner Quadruple System on `3n-2` points65Construction `3` | :func:`three_n_minus_eight` | Returns a Steiner Quadruple System on `3n-8` points66Construction `4` | :func:`three_n_minus_four` | Returns a Steiner Quadruple System on `3n-4` points67Construction `5` | :func:`four_n_minus_six` | Returns a Steiner Quadruple System on `4n-6` points68Construction `6` | :func:`twelve_n_minus_ten` | Returns a Steiner Quadruple System on `12n-10` points6970It also defines two specific Steiner Quadruple Systems that the constructions71require, i.e.`SQS_{14}` and `SQS_{38}` as well as the systems of pairs72`P_{\alpha}(m)` and `\overline P_{\alpha}(m)` (see [Hanani60]_).7374Functions75---------76"""77from sage.misc.cachefunc import cached_function7879# Construction 180def two_n(n,B):81r"""82Returns a Steiner Quadruple System on `2n` points.8384INPUT:8586- ``n`` (integer)8788- ``B`` -- A Steiner Quadruple System on `n` points.8990EXAMPLES::9192sage: from sage.combinat.designs.steiner_quadruple_systems import two_n, is_steiner_quadruple_system93sage: for n in xrange(4, 30):94....: if (n%6) in [2,4]:95....: sqs = designs.steiner_quadruple_system(n)96....: if not is_steiner_quadruple_system(2*n, two_n(n, sqs)):97....: print "Something is wrong !"9899"""100Y = []101102# Line 1103for x,y,z,t in B:104for a in xrange(2):105for b in xrange(2):106for c in xrange(2):107d = (a+b+c)%2108Y.append((x+a*n,y+b*n,z+c*n,t+d*n))109110# Line 2111for j in xrange(n):112for jj in xrange(j+1,n):113Y.append((j,jj,n+j,n+jj))114115return tuple(Y)116117# Construction 2118def three_n_minus_two(n,B):119"""120Returns a Steiner Quadruple System on `3n-2` points.121122INPUT:123124- ``n`` (integer)125126- ``B`` -- A Steiner Quadruple System on `n` points.127128EXAMPLES::129130sage: from sage.combinat.designs.steiner_quadruple_systems import three_n_minus_two, is_steiner_quadruple_system131sage: for n in xrange(4, 30):132....: if (n%6) in [2,4]:133....: sqs = designs.steiner_quadruple_system(n)134....: if not is_steiner_quadruple_system(3*n-2, three_n_minus_two(n, sqs)):135....: print "Something is wrong !"136137"""138A = n-1139Y = []140# relabel function141r = lambda i,x : (i%3)*(n-1)+x142for x,y,z,t in B:143if t == A:144# Line 2.145for a in xrange(3):146for b in xrange(3):147c = -(a+b)%3148Y.append((r(a,x),r(b,y),r(c,z),3*n-3))149150# Line 3.151Y.extend([(r(i,x),r(i,y),r(i+1,z),r(i+2,z)) for i in xrange(3)])152Y.extend([(r(i,x),r(i,z),r(i+1,y),r(i+2,y)) for i in xrange(3)])153Y.extend([(r(i,y),r(i,z),r(i+1,x),r(i+2,x)) for i in xrange(3)])154155else:156# Line 1.157for a in xrange(3):158for b in xrange(3):159for c in xrange(3):160d = -(a+b+c)%3161Y.append((r(a,x),r(b,y),r(c,z),r(d,t)))162163# Line 4.164for j in xrange(n-1):165for jj in xrange(j+1,n-1):166Y.extend([(r(i,j),r(i,jj),r(i+1,j),r(i+1,jj)) for i in xrange(3)])167168# Line 5.169for j in xrange(n-1):170Y.append((r(0,j),r(1,j),r(2,j),3*n-3))171172Y = tuple(map(tuple,map(sorted,Y)))173return Y174175# Construction 3176def three_n_minus_eight(n, B):177"""178Returns a Steiner Quadruple System on `3n-8` points.179180INPUT:181182- ``n`` -- an integer such that `n\equiv 2 \pmod{12}`.183184- ``B`` -- A Steiner Quadruple System on `n` points.185186EXAMPLES::187188sage: from sage.combinat.designs.steiner_quadruple_systems import three_n_minus_eight, is_steiner_quadruple_system189sage: for n in xrange(4, 30):190....: if (n%12) == 2:191....: sqs = designs.steiner_quadruple_system(n)192....: if not is_steiner_quadruple_system(3*n-8, three_n_minus_eight(n, sqs)):193....: print "Something is wrong !"194195"""196197if (n%12) != 2:198raise ValueError("n must be equal to 2 mod 12")199200B = relabel_system(n, B)201r = lambda i,x : (i%3)*(n-4)+(x%(n-4))202203# Line 1.204Y = [[x+2*(n-4) for x in B[0]]]205206# Line 2.207for s in B[1:]:208for i in xrange(3):209Y.append([r(i,x) if x<= n-5 else x+2*(n-4) for x in s])210211212# Line 3.213for a in xrange(4):214for aa in xrange(n-4):215for aaa in xrange(n-4):216aaaa = -(a+aa+aaa)%(n-4)217Y.append((r(0,aa),r(1,aaa), r(2,aaaa),3*(n-4)+a))218219220# Line 4.221k = (n-14)/12222for i in xrange(3):223for b in xrange(n-4):224for bb in xrange(n-4):225bbb = -(b+bb)%(n-4)226for d in xrange(2*k+1):227Y.append((r(i+2,bbb), r(i, b+2*k+1+i*(4*k+2)-d) , r(i, b+2*k+2+i*(4*k+2)+d), r(i+1,bb)))228229230231# Line 5.232for i in xrange(3):233for alpha in xrange(4*k+2, 12*k+9):234for ra,sa in P(alpha,6*k+5):235for raa,saa in P(alpha,6*k+5):236Y.append(tuple(sorted((r(i,ra),r(i,sa),r(i+1,raa), r(i+1,saa)))))237238239Y = tuple(map(tuple,map(sorted,Y)))240return Y241242# Construction 4243def three_n_minus_four(n, B):244"""245Returns a Steiner Quadruple System on `3n-4` points.246247INPUT:248249- ``n`` -- an integer such that `n\equiv 10\pmod{12}`250251- ``B`` -- A Steiner Quadruple System on `n` points.252253EXAMPLES::254255sage: from sage.combinat.designs.steiner_quadruple_systems import three_n_minus_four, is_steiner_quadruple_system256sage: for n in xrange(4, 30):257....: if n%12 == 10:258....: sqs = designs.steiner_quadruple_system(n)259....: if not is_steiner_quadruple_system(3*n-4, three_n_minus_four(n, sqs)):260....: print "Something is wrong !"261262"""263if n%12 != 10:264raise ValueError("n must be equal to 10 mod 12")265266B = relabel_system(n, B)267r = lambda i,x : (i%3)*(n-2)+(x%(n-2))268269# Line 1/2.270Y = []271for s in B:272for i in xrange(3):273Y.append(tuple(r(i,x) if x<= n-3 else x+2*(n-2) for x in s ))274275# Line 3.276for a in xrange(2):277for aa in xrange(n-2):278for aaa in xrange(n-2):279aaaa= -(a+aa+aaa)%(n-2)280Y.append((r(0,aa),r(1,aaa), r(2,aaaa),3*(n-2)+a))281282# Line 4.283k = (n-10)/12284for i in xrange(3):285for b in xrange(n-2):286for bb in xrange(n-2):287bbb = -(b+bb)%(n-2)288for d in xrange(2*k+1):289Y.append((r(i+2,bbb), r(i, b+2*k+1+i*(4*k+2)-d) , r(i, b+2*k+2+i*(4*k+2)+d), r(i+1,bb)))290291# Line 5.292from sage.graphs.graph_coloring import round_robin293one_factorization = round_robin(2*(6*k+4)).edges()294color_classes = [[] for j in xrange(2*(6*k+4)-1)]295for u,v,l in one_factorization:296color_classes[l].append((u,v))297298for i in xrange(3):299for alpha in xrange(4*k+2, 12*k+6+1):300for ra,sa in P(alpha, 6*k+4):301for raa,saa in P(alpha, 6*k+4):302Y.append(tuple(sorted((r(i,ra),r(i,sa),r(i+1,raa), r(i+1,saa)))))303304Y = tuple(map(tuple,map(sorted,Y)))305return Y306307# Construction 5308def four_n_minus_six(n, B):309"""310Returns a Steiner Quadruple System on `4n-6` points.311312INPUT:313314- ``n`` (integer)315316- ``B`` -- A Steiner Quadruple System on `n` points.317318EXAMPLES::319320sage: from sage.combinat.designs.steiner_quadruple_systems import four_n_minus_six, is_steiner_quadruple_system321sage: for n in xrange(4, 20):322....: if (n%6) in [2,4]:323....: sqs = designs.steiner_quadruple_system(n)324....: if not is_steiner_quadruple_system(4*n-6, four_n_minus_six(n, sqs)):325....: print "Something is wrong !"326327"""328329f = n-2330r = lambda i,ii,x : (2*(i%2)+(ii%2))*(n-2)+(x)%(n-2)331332# Line 1.333Y = []334for s in B:335for i in xrange(2):336for ii in xrange(2):337Y.append(tuple(r(i,ii,x) if x<= n-3 else x+3*(n-2) for x in s ))338339# Line 2/3/4/5340k = f/2341for l in xrange(2):342for eps in xrange(2):343for c in xrange(k):344for cc in xrange(k):345ccc = -(c+cc)%k346Y.append((4*(n-2)+l,r(0,0,2*c),r(0,1,2*cc-eps),r(1,eps,2*ccc+l)))347Y.append((4*(n-2)+l,r(0,0,2*c+1),r(0,1,2*cc-1-eps),r(1,eps,2*ccc+1-l)))348Y.append((4*(n-2)+l,r(1,0,2*c),r(1,1,2*cc-eps),r(0,eps,2*ccc+1-l)))349Y.append((4*(n-2)+l,r(1,0,2*c+1),r(1,1,2*cc-1-eps),r(0,eps,2*ccc+l)))350351# Line 6/7352for h in xrange(2):353for eps in xrange(2):354for ccc in xrange(k):355assert len(barP(ccc,k)) == k-1356for rc,sc in barP(ccc,k):357for c in xrange(k):358cc = -(c+ccc)%k359Y.append((r(h,0,2*c+eps),r(h,1,2*cc-eps),r(h+1,0,rc),r(h+1,0,sc)))360Y.append((r(h,0,2*c-1+eps),r(h,1,2*cc-eps),r(h+1,1,rc),r(h+1,1,sc)))361362363364# Line 8/9365for h in xrange(2):366for eps in xrange(2):367for ccc in xrange(k):368for rc,sc in barP(k+ccc,k):369for c in xrange(k):370cc = -(c+ccc)%k371Y.append((r(h,0,2*c+eps),r(h,1,2*cc-eps),r(h+1,1,rc),r(h+1,1,sc)))372Y.append((r(h,0,2*c-1+eps),r(h,1,2*cc-eps),r(h+1,0,rc),r(h+1,0,sc)))373374375# Line 10376for h in xrange(2):377for alpha in xrange(n-3):378for ra,sa in P(alpha,k):379for raa,saa in P(alpha,k):380Y.append((r(h,0,ra),r(h,0,sa),r(h,1,raa),r(h,1,saa)))381382Y = tuple(map(tuple,map(sorted,Y)))383return Y384385# Construction 6386def twelve_n_minus_ten(n, B):387"""388Returns a Steiner Quadruple System on `12n-6` points.389390INPUT:391392- ``n`` (integer)393394- ``B`` -- A Steiner Quadruple System on `n` points.395396EXAMPLES::397398sage: from sage.combinat.designs.steiner_quadruple_systems import twelve_n_minus_ten, is_steiner_quadruple_system399sage: for n in xrange(4, 15):400....: if (n%6) in [2,4]:401....: sqs = designs.steiner_quadruple_system(n)402....: if not is_steiner_quadruple_system(12*n-10, twelve_n_minus_ten(n, sqs)):403....: print "Something is wrong !"404405"""406407B14 = steiner_quadruple_system(14)408r = lambda i,x : i%(n-1)+(x%12)*(n-1)409k = n/2410411# Line 1.412Y = []413for s in B14:414for i in xrange(n-1):415Y.append(tuple(r(i,x) if x<= 11 else r(n-2,11)+x-11 for x in s ))416417for s in B:418if s[-1] == n-1:419u,v,w,B = s420dd = {0:u,1:v,2:w}421d = lambda x:dd[x%3]422for b in xrange(12):423for bb in xrange(12):424bbb = -(b+bb)%12425for h in xrange(2):426# Line 2427Y.append((r(n-2,11)+1+h,r(u,b),r(v,bb),r(w,bbb+3*h)))428429for i in xrange(3):430# Line 38.3431Y.append(( r(d(i),b+4+i), r(d(i),b+7+i), r(d(i+1),bb), r(d(i+2),bbb)))432433for j in xrange(12):434for eps in xrange(2):435for i in xrange(3):436# Line 38.4-38.7437Y.append(( r(d(i),j), r(d(i+1),j+6*eps ), r(d(i+2),6*eps-2*j+1), r(d(i+2),6*eps-2*j-1)))438Y.append(( r(d(i),j), r(d(i+1),j+6*eps ), r(d(i+2),6*eps-2*j+2), r(d(i+2),6*eps-2*j-2)))439Y.append(( r(d(i),j), r(d(i+1),j+6*eps-3), r(d(i+2),6*eps-2*j+1), r(d(i+2),6*eps-2*j+2)))440Y.append(( r(d(i),j), r(d(i+1),j+6*eps+3), r(d(i+2),6*eps-2*j-1), r(d(i+2),6*eps-2*j-2)))441442for j in xrange(6):443for i in xrange(3):444for eps in xrange(2):445# Line 38.8446Y.append(( r(d(i),j), r(d(i),j+6), r(d(i+1),j+3*eps), r(d(i+1),j+6+3*eps)))447448for j in xrange(12):449for i in xrange(3):450for eps in xrange(4):451# Line 38.11452Y.append(( r(d(i),j), r(d(i),j+1), r(d(i+1),j+3*eps), r(d(i+1),j+3*eps+1)))453# Line 38.12454Y.append(( r(d(i),j), r(d(i),j+2), r(d(i+1),j+3*eps), r(d(i+1),j+3*eps+2)))455# Line 38.13456Y.append(( r(d(i),j), r(d(i),j+4), r(d(i+1),j+3*eps), r(d(i+1),j+3*eps+4)))457458for alpha in [4,5]:459for ra,sa in P(alpha,6):460for raa,saa in P(alpha,6):461for i in xrange(3):462for ii in xrange(i+1,3):463# Line 38.14464Y.append(( r(d(i),ra), r(d(i),sa), r(d(ii),raa), r(d(ii),saa)))465466for g in xrange(6):467for eps in xrange(2):468for i in xrange(3):469for ii in xrange(3):470if i == ii:471continue472# Line 38.9473Y.append(( r(d(i),2*g+3*eps), r(d(i),2*g+6+3*eps), r(d(ii),2*g+1), r(d(ii),2*g+5)))474# Line 38.10475Y.append(( r(d(i),2*g+3*eps), r(d(i),2*g+6+3*eps), r(d(ii),2*g+2), r(d(ii),2*g+4)))476477else:478x,y,z,t = s479for a in xrange(12):480for aa in xrange(12):481for aaa in xrange(12):482aaaa = -(a+aa+aaa)%12483# Line 3484Y.append((r(x,a), r(y,aa), r(z,aaa), r(t,aaaa)))485return Y486487def relabel_system(n,B):488r"""489Relabels the set so that `\{n-4, n-3, n-2, n-1\}` is in `B`.490491INPUT:492493- ``n`` -- an integer494495- ``B`` -- a list of 4-uples on `0,...,n-1`.496497EXAMPLE::498499sage: from sage.combinat.designs.steiner_quadruple_systems import relabel_system500sage: designs.steiner_quadruple_system(8)501((0, 1, 2, 3), (0, 1, 6, 7), (0, 5, 2, 7), (0, 5, 6, 3), (4, 1, 2, 7),502(4, 1, 6, 3), (4, 5, 2, 3), (4, 5, 6, 7), (0, 1, 4, 5), (0, 2, 4, 6),503(0, 3, 4, 7), (1, 2, 5, 6), (1, 3, 5, 7), (2, 3, 6, 7))504sage: relabel_system(8,designs.steiner_quadruple_system(8))505((4, 5, 6, 7), (0, 1, 4, 5), (1, 2, 4, 6), (0, 2, 4, 7), (1, 3, 5, 6),506(0, 3, 5, 7), (2, 3, 6, 7), (0, 1, 2, 3), (2, 3, 4, 5), (0, 3, 4, 6),507(1, 3, 4, 7), (0, 2, 5, 6), (1, 2, 5, 7), (0, 1, 6, 7))508"""509510label = {511B[0][0] : n-4,512B[0][1] : n-3,513B[0][2] : n-2,514B[0][3] : n-1515}516517def get_label(x):518if x in label:519return label[x]520else:521total = len(label)-4522label[x] = total523return total524525B = tuple([tuple(sorted(map(get_label,s))) for s in B])526return B527528def P(alpha, m):529r"""530Returns the collection of pairs `P_{\alpha}(m)`531532For more information on this system, see [Hanani60]_.533534EXAMPLE::535536sage: from sage.combinat.designs.steiner_quadruple_systems import P537sage: P(3,4)538[(0, 5), (2, 7), (4, 1), (6, 3)]539"""540if alpha >= 2*m-1:541raise Exception542if m%2==0:543if alpha < m:544if alpha%2 == 0:545b = alpha/2546return [(2*a, (2*a + 2*b + 1)%(2*m)) for a in xrange(m)]547else:548b = (alpha-1)/2549return [(2*a, (2*a - 2*b - 1)%(2*m)) for a in xrange(m)]550else:551y = alpha - m552pairs = [(b,(2*y-b)%(2*m)) for b in xrange(y)]553pairs += [(c,(2*m+2*y-c-2)%(2*m)) for c in xrange(2*y+1,m+y-1)]554pairs += [(2*m+int(-1.5-.5*(-1)**y),y),(2*m+int(-1.5+.5*(-1)**y),m+y-1)]555return pairs556else:557if alpha < m-1:558if alpha % 2 == 0:559b = alpha/2560return [(2*a,(2*a+2*b+1)%(2*m)) for a in xrange(m)]561else:562b = (alpha-1)/2563return [(2*a,(2*a-2*b-1)%(2*m)) for a in xrange(m)]564else:565y = alpha-m+1566pairs = [(b,2*y-b) for b in xrange(y)]567pairs += [(c,2*m+2*y-c) for c in xrange(2*y+1,m+y)]568pairs += [(y,m+y)]569return pairs570571def _missing_pair(n,l):572r"""573Returns the smallest `(x,x+1)` that is not contained in `l`.574575EXAMPLE::576577sage: from sage.combinat.designs.steiner_quadruple_systems import _missing_pair578sage: _missing_pair(6, [(0,1), (4,5)])579(2, 3)580"""581l = [x for X in l for x in X]582for x in xrange(n):583if not x in l:584break585586assert not x in l587assert not x+1 in l588return (x,x+1)589590def barP(eps, m):591r"""592Returns the collection of pairs `\overline P_{\alpha}(m)`593594For more information on this system, see [Hanani60]_.595596EXAMPLE::597598sage: from sage.combinat.designs.steiner_quadruple_systems import barP599sage: barP(3,4)600[(0, 4), (3, 5), (1, 2)]601"""602return barP_system(m)[eps]603604@cached_function605def barP_system(m):606r"""607Returns the 1-factorization of `K_{2m}` `\overline P(m)`608609For more information on this system, see [Hanani60]_.610611EXAMPLE::612613sage: from sage.combinat.designs.steiner_quadruple_systems import barP_system614sage: barP_system(3)615[[(4, 3), (2, 5)],616[(0, 5), (4, 1)],617[(0, 2), (1, 3)],618[(1, 5), (4, 2), (0, 3)],619[(0, 4), (3, 5), (1, 2)],620[(0, 1), (2, 3), (4, 5)]]621"""622isequal = lambda e1,e2 : e1 == e2 or e1 == tuple(reversed(e2))623pairs = []624last = []625626if m % 2 == 0:627# The first (shorter) collections of pairs, obtained from P by removing628# pairs. Those are added to 'last', a new list of pairs629last = []630for n in xrange(1,(m-2)/2+1):631pairs.append([p for p in P(2*n,m) if not isequal(p,(2*n,(4*n+1)%(2*m)))])632last.append((2*n,(4*n+1)%(2*m)))633pairs.append([p for p in P(2*n-1,m) if not isequal(p,(2*m-2-2*n,2*m-1-4*n))])634last.append((2*m-2-2*n,2*m-1-4*n))635636pairs.append([p for p in P(m,m) if not isequal(p,(2*m-2,0))])637last.append((2*m-2,0))638pairs.append([p for p in P(m+1,m) if not isequal(p,(2*m-1,1))])639last.append((2*m-1,1))640641assert all(len(pp) == m-1 for pp in pairs)642assert len(last) == m643644# Pairs of normal length645646pairs.append(P(0,m))647pairs.append(P(m-1,m))648649for alpha in xrange(m+2,2*m-1):650pairs.append(P(alpha,m))651pairs.append(last)652653assert len(pairs) == 2*m654655# Now the points must be relabeled656relabel = {}657for n in xrange(1,(m-2)/2+1):658relabel[2*n] = (4*n)%(2*m)659relabel[4*n+1] = (4*n+1)%(2*m)660relabel[2*m-2-2*n] = (4*n-2)%(2*m)661relabel[2*m-1-4*n] = (4*n-1)%(2*m)662663relabel[2*m-2] = (1)%(2*m)664relabel[0] = 0665relabel[2*m-1] = 2*m-1666relabel[1] = 2*m-2667668else:669# The first (shorter) collections of pairs, obtained from P by removing670# pairs. Those are added to 'last', a new list of pairs671672last = []673for n in xrange(0,(m-3)/2+1):674pairs.append([p for p in P(2*n,m) if not isequal(p,(2*n,(4*n+1)%(2*m)))])675last.append((2*n,(4*n+1)%(2*m)))676pairs.append([p for p in P(2*n+1,m) if not isequal(p,(2*m-2-2*n,2*m-3-4*n))])677last.append((2*m-2-2*n,2*m-3-4*n))678679pairs.append([p for p in P(2*m-2,m) if not isequal(p,(m-1,2*m-1))])680last.append((m-1,2*m-1))681682assert all(len(pp) == m-1 for pp in pairs)683assert len(pairs) == m684685# Pairs of normal length686687for alpha in xrange(m-1,2*m-2):688pairs.append(P(alpha,m))689pairs.append(last)690691assert len(pairs) == 2*m692693# Now the points must be relabeled694relabel = {}695for n in xrange(0,(m-3)/2+1):696relabel[2*n] = (4*n)%(2*m)697relabel[4*n+1] = (4*n+1)%(2*m)698relabel[2*m-2-2*n] = (4*n+2)%(2*m)699relabel[2*m-3-4*n] = (4*n+3)%(2*m)700relabel[m-1] = (2*m-2)%(2*m)701relabel[2*m-1] = 2*m-1702703assert len(relabel) == 2*m704assert len(pairs) == 2*m705706# Relabeling the points707708pairs = [[(relabel[x],relabel[y]) for x,y in pp] for pp in pairs]709710# Pairs are sorted first according to their cardinality, then using the711# number of the smallest point that they do NOT contain.712pairs.sort(key=lambda x: _missing_pair(2*m+1,x))713714return pairs715716@cached_function717def steiner_quadruple_system(n, check = False):718r"""719Returns a Steiner Quadruple System on `n` points.720721INPUT:722723- ``n`` -- an integer such that `n\equiv 2,4\pmod 6`724725- ``check`` (boolean) -- whether to check that the system is a Steiner726Quadruple System before returning it (`False` by default)727728EXAMPLES::729730sage: designs.steiner_quadruple_system(4)731((0, 1, 2, 3),)732sage: designs.steiner_quadruple_system(8)733((0, 1, 2, 3), (0, 1, 6, 7), (0, 5, 2, 7), (0, 5, 6, 3), (4, 1, 2, 7),734(4, 1, 6, 3), (4, 5, 2, 3), (4, 5, 6, 7), (0, 1, 4, 5), (0, 2, 4, 6),735(0, 3, 4, 7), (1, 2, 5, 6), (1, 3, 5, 7), (2, 3, 6, 7))736737TESTS::738739sage: for n in xrange(4, 100): # long time740....: if (n%6) in [2,4]: # long time741....: sqs = designs.steiner_quadruple_system(n, check=True) # long time742"""743n = int(n)744if not ((n%6) in [2, 4]):745raise ValueError("n mod 6 must be equal to 2 or 4")746elif n == 4:747return ((0,1,2,3),)748elif n == 14:749return _SQS14()750elif n == 38:751return _SQS38()752elif (n%12) in [4,8]:753nn = n/2754sqs = two_n(nn,steiner_quadruple_system(nn, check = False))755elif (n%18) in [4,10]:756nn = (n+2)/3757sqs = three_n_minus_two(nn,steiner_quadruple_system(nn, check = False))758elif (n%36) == 34:759nn = (n+8)/3760sqs = three_n_minus_eight(nn,steiner_quadruple_system(nn, check = False))761elif (n%36) == 26 :762nn = (n+4)/3763sqs = three_n_minus_four(nn,steiner_quadruple_system(nn, check = False))764elif (n%24) in [2,10]:765nn = (n+6)/4766sqs = four_n_minus_six(nn,steiner_quadruple_system(nn, check = False))767elif (n%72) in [14,38]:768nn = (n+10)/12769sqs = twelve_n_minus_ten(nn, steiner_quadruple_system(nn, check = False))770else:771raise ValueError("This shouldn't happen !")772773if check:774if not is_steiner_quadruple_system(n, sqs):775raise RuntimeError("Something is very very wrong.")776777return sqs778779def is_steiner_quadruple_system(n,B):780r"""781Tests if `B` is a Steiner Quadruple System on `0,...,n-1`.782783INPUT:784785- ``n`` (integer)786787- ``B`` -- a list of quadruples.788789EXAMPLES::790791sage: from sage.combinat.designs.steiner_quadruple_systems import is_steiner_quadruple_system792sage: is_steiner_quadruple_system(8,designs.steiner_quadruple_system(8))793True794"""795from sage.rings.arith import binomial796# Cardinality797if len(B)*4 != binomial(n,3):798return False799800# Vertex set801V = set([])802for b in B:803for x in b:804V.add(x)805806if V != set(range(n)):807return False808809# No two 4-sets intersect on 3 elements.810from itertools import combinations811s = set([])812for b in B:813for e in combinations(b,3):814if frozenset(e) in s:815return False816s.add(frozenset(e))817818return True819820821def _SQS14():822r"""823Returns a Steiner Quadruple System on 14 points.824825Obtained form the La Jolla Covering Repository.826827EXAMPLE::828829sage: from sage.combinat.designs.steiner_quadruple_systems import is_steiner_quadruple_system, _SQS14830sage: is_steiner_quadruple_system(14,_SQS14())831True832"""833return ((0, 1, 2, 5), (0, 1, 3, 6), (0, 1, 4, 13), (0, 1, 7, 10), (0, 1, 8, 9),834(0, 1, 11, 12), (0, 2, 3, 4), (0, 2, 6, 12), (0, 2, 7, 9), (0, 2, 8, 11),835(0, 2, 10, 13), (0, 3, 5, 13), (0, 3, 7, 11), (0, 3, 8, 10), (0, 3, 9, 12),836(0, 4, 5, 9), (0, 4, 6, 11), (0, 4, 7, 8), (0, 4, 10, 12), (0, 5, 6, 8),837(0, 5, 7, 12), (0, 5, 10, 11), (0, 6, 7, 13), (0, 6, 9, 10), (0, 8, 12, 13),838(0, 9, 11, 13), (1, 2, 3, 13), (1, 2, 4, 12), (1, 2, 6, 9), (1, 2, 7, 11),839(1, 2, 8, 10), (1, 3, 4, 5), (1, 3, 7, 8), (1, 3, 9, 11), (1, 3, 10, 12),840(1, 4, 6, 10), (1, 4, 7, 9), (1, 4, 8, 11), (1, 5, 6, 11), (1, 5, 7, 13),841(1, 5, 8, 12), (1, 5, 9, 10), (1, 6, 7, 12), (1, 6, 8, 13), (1, 9, 12, 13),842(1, 10, 11, 13), (2, 3, 5, 11), (2, 3, 6, 7), (2, 3, 8, 12), (2, 3, 9, 10),843(2, 4, 5, 13), (2, 4, 6, 8), (2, 4, 7, 10), (2, 4, 9, 11), (2, 5, 6, 10),844(2, 5, 7, 8), (2, 5, 9, 12), (2, 6, 11, 13), (2, 7, 12, 13), (2, 8, 9, 13),845(2, 10, 11, 12), (3, 4, 6, 9), (3, 4, 7, 12), (3, 4, 8, 13), (3, 4, 10, 11),846(3, 5, 6, 12), (3, 5, 7, 10), (3, 5, 8, 9), (3, 6, 8, 11), (3, 6, 10, 13),847(3, 7, 9, 13), (3, 11, 12, 13), (4, 5, 6, 7), (4, 5, 8, 10), (4, 5, 11, 12),848(4, 6, 12, 13), (4, 7, 11, 13), (4, 8, 9, 12), (4, 9, 10, 13), (5, 6, 9, 13),849(5, 7, 9, 11), (5, 8, 11, 13), (5, 10, 12, 13), (6, 7, 8, 9), (6, 7, 10, 11),850(6, 8, 10, 12), (6, 9, 11, 12), (7, 8, 10, 13), (7, 8, 11, 12), (7, 9, 10, 12),851(8, 9, 10, 11))852853def _SQS38():854r"""855Returns a Steiner Quadruple System on 14 points.856857Obtained form the La Jolla Covering Repository.858859EXAMPLE::860861sage: from sage.combinat.designs.steiner_quadruple_systems import is_steiner_quadruple_system, _SQS38862sage: is_steiner_quadruple_system(38,_SQS38())863True864"""865866# From the La Jolla Covering Repository867return ((0, 1, 2, 14), (0, 1, 3, 34), (0, 1, 4, 31), (0, 1, 5, 27), (0, 1, 6, 17),868(0, 1, 7, 12), (0, 1, 8, 36), (0, 1, 9, 10), (0, 1, 11, 18), (0, 1, 13, 37),869(0, 1, 15, 35), (0, 1, 16, 22), (0, 1, 19, 33), (0, 1, 20, 25), (0, 1, 21, 23),870(0, 1, 24, 32), (0, 1, 26, 28), (0, 1, 29, 30), (0, 2, 3, 10), (0, 2, 4, 9),871(0, 2, 5, 28), (0, 2, 6, 15), (0, 2, 7, 36), (0, 2, 8, 23), (0, 2, 11, 22),872(0, 2, 12, 13), (0, 2, 16, 25), (0, 2, 17, 18), (0, 2, 19, 30), (0, 2, 20, 35),873(0, 2, 21, 29), (0, 2, 24, 34), (0, 2, 26, 31), (0, 2, 27, 32), (0, 2, 33, 37),874(0, 3, 4, 18), (0, 3, 5, 23), (0, 3, 6, 32), (0, 3, 7, 19), (0, 3, 8, 20),875(0, 3, 9, 17), (0, 3, 11, 25), (0, 3, 12, 24), (0, 3, 13, 27), (0, 3, 14, 31),876(0, 3, 15, 22), (0, 3, 16, 28), (0, 3, 21, 33), (0, 3, 26, 36), (0, 3, 29, 35),877(0, 3, 30, 37), (0, 4, 5, 7), (0, 4, 6, 28), (0, 4, 8, 25), (0, 4, 10, 30),878(0, 4, 11, 20), (0, 4, 12, 32), (0, 4, 13, 36), (0, 4, 14, 29), (0, 4, 15, 27),879(0, 4, 16, 35), (0, 4, 17, 22), (0, 4, 19, 23), (0, 4, 21, 34), (0, 4, 24, 33),880(0, 4, 26, 37), (0, 5, 6, 24), (0, 5, 8, 26), (0, 5, 9, 29), (0, 5, 10, 20),881(0, 5, 11, 13), (0, 5, 12, 14), (0, 5, 15, 33), (0, 5, 16, 37), (0, 5, 17, 35),882(0, 5, 18, 19), (0, 5, 21, 25), (0, 5, 22, 30), (0, 5, 31, 32), (0, 5, 34, 36),883(0, 6, 7, 30), (0, 6, 8, 33), (0, 6, 9, 12), (0, 6, 10, 18), (0, 6, 11, 37),884(0, 6, 13, 31), (0, 6, 14, 35), (0, 6, 16, 29), (0, 6, 19, 25), (0, 6, 20, 27),885(0, 6, 21, 36), (0, 6, 22, 23), (0, 6, 26, 34), (0, 7, 8, 11), (0, 7, 9, 33),886(0, 7, 10, 21), (0, 7, 13, 20), (0, 7, 14, 22), (0, 7, 15, 31), (0, 7, 16, 34),887(0, 7, 17, 29), (0, 7, 18, 24), (0, 7, 23, 26), (0, 7, 25, 32), (0, 7, 27, 28),888(0, 7, 35, 37), (0, 8, 9, 37), (0, 8, 10, 27), (0, 8, 12, 18), (0, 8, 13, 30),889(0, 8, 14, 15), (0, 8, 16, 21), (0, 8, 17, 19), (0, 8, 22, 35), (0, 8, 24, 31),890(0, 8, 28, 34), (0, 8, 29, 32), (0, 9, 11, 30), (0, 9, 13, 23), (0, 9, 14, 18),891(0, 9, 15, 25), (0, 9, 16, 26), (0, 9, 19, 28), (0, 9, 20, 36), (0, 9, 21, 35),892(0, 9, 22, 24), (0, 9, 27, 31), (0, 9, 32, 34), (0, 10, 11, 36),893(0, 10, 12, 15), (0, 10, 13, 26), (0, 10, 14, 16), (0, 10, 17, 37),894(0, 10, 19, 29), (0, 10, 22, 31), (0, 10, 23, 32), (0, 10, 24, 35),895(0, 10, 25, 34), (0, 10, 28, 33), (0, 11, 12, 16), (0, 11, 14, 24),896(0, 11, 15, 26), (0, 11, 17, 31), (0, 11, 19, 21), (0, 11, 23, 34),897(0, 11, 27, 29), (0, 11, 28, 35), (0, 11, 32, 33), (0, 12, 17, 20),898(0, 12, 19, 35), (0, 12, 21, 28), (0, 12, 22, 25), (0, 12, 23, 27),899(0, 12, 26, 29), (0, 12, 30, 33), (0, 12, 31, 34), (0, 12, 36, 37),900(0, 13, 14, 33), (0, 13, 15, 29), (0, 13, 16, 24), (0, 13, 17, 21),901(0, 13, 18, 34), (0, 13, 19, 32), (0, 13, 22, 28), (0, 13, 25, 35),902(0, 14, 17, 26), (0, 14, 19, 20), (0, 14, 21, 32), (0, 14, 23, 36),903(0, 14, 25, 28), (0, 14, 27, 30), (0, 14, 34, 37), (0, 15, 16, 36),904(0, 15, 17, 23), (0, 15, 18, 20), (0, 15, 19, 34), (0, 15, 21, 37),905(0, 15, 24, 28), (0, 15, 30, 32), (0, 16, 17, 32), (0, 16, 18, 27),906(0, 16, 19, 31), (0, 16, 20, 33), (0, 16, 23, 30), (0, 17, 24, 27),907(0, 17, 25, 33), (0, 17, 28, 36), (0, 17, 30, 34), (0, 18, 21, 26),908(0, 18, 22, 29), (0, 18, 23, 28), (0, 18, 25, 31), (0, 18, 30, 35),909(0, 18, 32, 37), (0, 18, 33, 36), (0, 19, 22, 26), (0, 19, 24, 37),910(0, 19, 27, 36), (0, 20, 21, 31), (0, 20, 22, 37), (0, 20, 23, 24),911(0, 20, 26, 30), (0, 20, 28, 32), (0, 20, 29, 34), (0, 21, 22, 27),912(0, 21, 24, 30), (0, 22, 32, 36), (0, 22, 33, 34), (0, 23, 25, 29),913(0, 23, 31, 37), (0, 23, 33, 35), (0, 24, 25, 26), (0, 24, 29, 36),914(0, 25, 27, 37), (0, 25, 30, 36), (0, 26, 27, 33), (0, 26, 32, 35),915(0, 27, 34, 35), (0, 28, 29, 37), (0, 28, 30, 31), (0, 29, 31, 33),916(0, 31, 35, 36), (1, 2, 3, 15), (1, 2, 4, 35), (1, 2, 5, 32), (1, 2, 6, 28),917(1, 2, 7, 18), (1, 2, 8, 13), (1, 2, 9, 37), (1, 2, 10, 11), (1, 2, 12, 19),918(1, 2, 16, 36), (1, 2, 17, 23), (1, 2, 20, 34), (1, 2, 21, 26), (1, 2, 22, 24),919(1, 2, 25, 33), (1, 2, 27, 29), (1, 2, 30, 31), (1, 3, 4, 11), (1, 3, 5, 10),920(1, 3, 6, 29), (1, 3, 7, 16), (1, 3, 8, 37), (1, 3, 9, 24), (1, 3, 12, 23),921(1, 3, 13, 14), (1, 3, 17, 26), (1, 3, 18, 19), (1, 3, 20, 31), (1, 3, 21, 36),922(1, 3, 22, 30), (1, 3, 25, 35), (1, 3, 27, 32), (1, 3, 28, 33), (1, 4, 5, 19),923(1, 4, 6, 24), (1, 4, 7, 33), (1, 4, 8, 20), (1, 4, 9, 21), (1, 4, 10, 18),924(1, 4, 12, 26), (1, 4, 13, 25), (1, 4, 14, 28), (1, 4, 15, 32), (1, 4, 16, 23),925(1, 4, 17, 29), (1, 4, 22, 34), (1, 4, 27, 37), (1, 4, 30, 36), (1, 5, 6, 8),926(1, 5, 7, 29), (1, 5, 9, 26), (1, 5, 11, 31), (1, 5, 12, 21), (1, 5, 13, 33),927(1, 5, 14, 37), (1, 5, 15, 30), (1, 5, 16, 28), (1, 5, 17, 36), (1, 5, 18, 23),928(1, 5, 20, 24), (1, 5, 22, 35), (1, 5, 25, 34), (1, 6, 7, 25), (1, 6, 9, 27),929(1, 6, 10, 30), (1, 6, 11, 21), (1, 6, 12, 14), (1, 6, 13, 15), (1, 6, 16, 34),930(1, 6, 18, 36), (1, 6, 19, 20), (1, 6, 22, 26), (1, 6, 23, 31), (1, 6, 32, 33),931(1, 6, 35, 37), (1, 7, 8, 31), (1, 7, 9, 34), (1, 7, 10, 13), (1, 7, 11, 19),932(1, 7, 14, 32), (1, 7, 15, 36), (1, 7, 17, 30), (1, 7, 20, 26), (1, 7, 21, 28),933(1, 7, 22, 37), (1, 7, 23, 24), (1, 7, 27, 35), (1, 8, 9, 12), (1, 8, 10, 34),934(1, 8, 11, 22), (1, 8, 14, 21), (1, 8, 15, 23), (1, 8, 16, 32), (1, 8, 17, 35),935(1, 8, 18, 30), (1, 8, 19, 25), (1, 8, 24, 27), (1, 8, 26, 33), (1, 8, 28, 29),936(1, 9, 11, 28), (1, 9, 13, 19), (1, 9, 14, 31), (1, 9, 15, 16), (1, 9, 17, 22),937(1, 9, 18, 20), (1, 9, 23, 36), (1, 9, 25, 32), (1, 9, 29, 35), (1, 9, 30, 33),938(1, 10, 12, 31), (1, 10, 14, 24), (1, 10, 15, 19), (1, 10, 16, 26),939(1, 10, 17, 27), (1, 10, 20, 29), (1, 10, 21, 37), (1, 10, 22, 36),940(1, 10, 23, 25), (1, 10, 28, 32), (1, 10, 33, 35), (1, 11, 12, 37),941(1, 11, 13, 16), (1, 11, 14, 27), (1, 11, 15, 17), (1, 11, 20, 30),942(1, 11, 23, 32), (1, 11, 24, 33), (1, 11, 25, 36), (1, 11, 26, 35),943(1, 11, 29, 34), (1, 12, 13, 17), (1, 12, 15, 25), (1, 12, 16, 27),944(1, 12, 18, 32), (1, 12, 20, 22), (1, 12, 24, 35), (1, 12, 28, 30),945(1, 12, 29, 36), (1, 12, 33, 34), (1, 13, 18, 21), (1, 13, 20, 36),946(1, 13, 22, 29), (1, 13, 23, 26), (1, 13, 24, 28), (1, 13, 27, 30),947(1, 13, 31, 34), (1, 13, 32, 35), (1, 14, 15, 34), (1, 14, 16, 30),948(1, 14, 17, 25), (1, 14, 18, 22), (1, 14, 19, 35), (1, 14, 20, 33),949(1, 14, 23, 29), (1, 14, 26, 36), (1, 15, 18, 27), (1, 15, 20, 21),950(1, 15, 22, 33), (1, 15, 24, 37), (1, 15, 26, 29), (1, 15, 28, 31),951(1, 16, 17, 37), (1, 16, 18, 24), (1, 16, 19, 21), (1, 16, 20, 35),952(1, 16, 25, 29), (1, 16, 31, 33), (1, 17, 18, 33), (1, 17, 19, 28),953(1, 17, 20, 32), (1, 17, 21, 34), (1, 17, 24, 31), (1, 18, 25, 28),954(1, 18, 26, 34), (1, 18, 29, 37), (1, 18, 31, 35), (1, 19, 22, 27),955(1, 19, 23, 30), (1, 19, 24, 29), (1, 19, 26, 32), (1, 19, 31, 36),956(1, 19, 34, 37), (1, 20, 23, 27), (1, 20, 28, 37), (1, 21, 22, 32),957(1, 21, 24, 25), (1, 21, 27, 31), (1, 21, 29, 33), (1, 21, 30, 35),958(1, 22, 23, 28), (1, 22, 25, 31), (1, 23, 33, 37), (1, 23, 34, 35),959(1, 24, 26, 30), (1, 24, 34, 36), (1, 25, 26, 27), (1, 25, 30, 37),960(1, 26, 31, 37), (1, 27, 28, 34), (1, 27, 33, 36), (1, 28, 35, 36),961(1, 29, 31, 32), (1, 30, 32, 34), (1, 32, 36, 37), (2, 3, 4, 16),962(2, 3, 5, 36), (2, 3, 6, 33), (2, 3, 7, 29), (2, 3, 8, 19), (2, 3, 9, 14),963(2, 3, 11, 12), (2, 3, 13, 20), (2, 3, 17, 37), (2, 3, 18, 24), (2, 3, 21, 35),964(2, 3, 22, 27), (2, 3, 23, 25), (2, 3, 26, 34), (2, 3, 28, 30), (2, 3, 31, 32),965(2, 4, 5, 12), (2, 4, 6, 11), (2, 4, 7, 30), (2, 4, 8, 17), (2, 4, 10, 25),966(2, 4, 13, 24), (2, 4, 14, 15), (2, 4, 18, 27), (2, 4, 19, 20), (2, 4, 21, 32),967(2, 4, 22, 37), (2, 4, 23, 31), (2, 4, 26, 36), (2, 4, 28, 33), (2, 4, 29, 34),968(2, 5, 6, 20), (2, 5, 7, 25), (2, 5, 8, 34), (2, 5, 9, 21), (2, 5, 10, 22),969(2, 5, 11, 19), (2, 5, 13, 27), (2, 5, 14, 26), (2, 5, 15, 29), (2, 5, 16, 33),970(2, 5, 17, 24), (2, 5, 18, 30), (2, 5, 23, 35), (2, 5, 31, 37), (2, 6, 7, 9),971(2, 6, 8, 30), (2, 6, 10, 27), (2, 6, 12, 32), (2, 6, 13, 22), (2, 6, 14, 34),972(2, 6, 16, 31), (2, 6, 17, 29), (2, 6, 18, 37), (2, 6, 19, 24), (2, 6, 21, 25),973(2, 6, 23, 36), (2, 6, 26, 35), (2, 7, 8, 26), (2, 7, 10, 28), (2, 7, 11, 31),974(2, 7, 12, 22), (2, 7, 13, 15), (2, 7, 14, 16), (2, 7, 17, 35), (2, 7, 19, 37),975(2, 7, 20, 21), (2, 7, 23, 27), (2, 7, 24, 32), (2, 7, 33, 34), (2, 8, 9, 32),976(2, 8, 10, 35), (2, 8, 11, 14), (2, 8, 12, 20), (2, 8, 15, 33), (2, 8, 16, 37),977(2, 8, 18, 31), (2, 8, 21, 27), (2, 8, 22, 29), (2, 8, 24, 25), (2, 8, 28, 36),978(2, 9, 10, 13), (2, 9, 11, 35), (2, 9, 12, 23), (2, 9, 15, 22), (2, 9, 16, 24),979(2, 9, 17, 33), (2, 9, 18, 36), (2, 9, 19, 31), (2, 9, 20, 26), (2, 9, 25, 28),980(2, 9, 27, 34), (2, 9, 29, 30), (2, 10, 12, 29), (2, 10, 14, 20),981(2, 10, 15, 32), (2, 10, 16, 17), (2, 10, 18, 23), (2, 10, 19, 21),982(2, 10, 24, 37), (2, 10, 26, 33), (2, 10, 30, 36), (2, 10, 31, 34),983(2, 11, 13, 32), (2, 11, 15, 25), (2, 11, 16, 20), (2, 11, 17, 27),984(2, 11, 18, 28), (2, 11, 21, 30), (2, 11, 23, 37), (2, 11, 24, 26),985(2, 11, 29, 33), (2, 11, 34, 36), (2, 12, 14, 17), (2, 12, 15, 28),986(2, 12, 16, 18), (2, 12, 21, 31), (2, 12, 24, 33), (2, 12, 25, 34),987(2, 12, 26, 37), (2, 12, 27, 36), (2, 12, 30, 35), (2, 13, 14, 18),988(2, 13, 16, 26), (2, 13, 17, 28), (2, 13, 19, 33), (2, 13, 21, 23),989(2, 13, 25, 36), (2, 13, 29, 31), (2, 13, 30, 37), (2, 13, 34, 35),990(2, 14, 19, 22), (2, 14, 21, 37), (2, 14, 23, 30), (2, 14, 24, 27),991(2, 14, 25, 29), (2, 14, 28, 31), (2, 14, 32, 35), (2, 14, 33, 36),992(2, 15, 16, 35), (2, 15, 17, 31), (2, 15, 18, 26), (2, 15, 19, 23),993(2, 15, 20, 36), (2, 15, 21, 34), (2, 15, 24, 30), (2, 15, 27, 37),994(2, 16, 19, 28), (2, 16, 21, 22), (2, 16, 23, 34), (2, 16, 27, 30),995(2, 16, 29, 32), (2, 17, 19, 25), (2, 17, 20, 22), (2, 17, 21, 36),996(2, 17, 26, 30), (2, 17, 32, 34), (2, 18, 19, 34), (2, 18, 20, 29),997(2, 18, 21, 33), (2, 18, 22, 35), (2, 18, 25, 32), (2, 19, 26, 29),998(2, 19, 27, 35), (2, 19, 32, 36), (2, 20, 23, 28), (2, 20, 24, 31),999(2, 20, 25, 30), (2, 20, 27, 33), (2, 20, 32, 37), (2, 21, 24, 28),1000(2, 22, 23, 33), (2, 22, 25, 26), (2, 22, 28, 32), (2, 22, 30, 34),1001(2, 22, 31, 36), (2, 23, 24, 29), (2, 23, 26, 32), (2, 24, 35, 36),1002(2, 25, 27, 31), (2, 25, 35, 37), (2, 26, 27, 28), (2, 28, 29, 35),1003(2, 28, 34, 37), (2, 29, 36, 37), (2, 30, 32, 33), (2, 31, 33, 35),1004(3, 4, 5, 17), (3, 4, 6, 37), (3, 4, 7, 34), (3, 4, 8, 30), (3, 4, 9, 20),1005(3, 4, 10, 15), (3, 4, 12, 13), (3, 4, 14, 21), (3, 4, 19, 25), (3, 4, 22, 36),1006(3, 4, 23, 28), (3, 4, 24, 26), (3, 4, 27, 35), (3, 4, 29, 31), (3, 4, 32, 33),1007(3, 5, 6, 13), (3, 5, 7, 12), (3, 5, 8, 31), (3, 5, 9, 18), (3, 5, 11, 26),1008(3, 5, 14, 25), (3, 5, 15, 16), (3, 5, 19, 28), (3, 5, 20, 21), (3, 5, 22, 33),1009(3, 5, 24, 32), (3, 5, 27, 37), (3, 5, 29, 34), (3, 5, 30, 35), (3, 6, 7, 21),1010(3, 6, 8, 26), (3, 6, 9, 35), (3, 6, 10, 22), (3, 6, 11, 23), (3, 6, 12, 20),1011(3, 6, 14, 28), (3, 6, 15, 27), (3, 6, 16, 30), (3, 6, 17, 34), (3, 6, 18, 25),1012(3, 6, 19, 31), (3, 6, 24, 36), (3, 7, 8, 10), (3, 7, 9, 31), (3, 7, 11, 28),1013(3, 7, 13, 33), (3, 7, 14, 23), (3, 7, 15, 35), (3, 7, 17, 32), (3, 7, 18, 30),1014(3, 7, 20, 25), (3, 7, 22, 26), (3, 7, 24, 37), (3, 7, 27, 36), (3, 8, 9, 27),1015(3, 8, 11, 29), (3, 8, 12, 32), (3, 8, 13, 23), (3, 8, 14, 16), (3, 8, 15, 17),1016(3, 8, 18, 36), (3, 8, 21, 22), (3, 8, 24, 28), (3, 8, 25, 33), (3, 8, 34, 35),1017(3, 9, 10, 33), (3, 9, 11, 36), (3, 9, 12, 15), (3, 9, 13, 21), (3, 9, 16, 34),1018(3, 9, 19, 32), (3, 9, 22, 28), (3, 9, 23, 30), (3, 9, 25, 26), (3, 9, 29, 37),1019(3, 10, 11, 14), (3, 10, 12, 36), (3, 10, 13, 24), (3, 10, 16, 23),1020(3, 10, 17, 25), (3, 10, 18, 34), (3, 10, 19, 37), (3, 10, 20, 32),1021(3, 10, 21, 27), (3, 10, 26, 29), (3, 10, 28, 35), (3, 10, 30, 31),1022(3, 11, 13, 30), (3, 11, 15, 21), (3, 11, 16, 33), (3, 11, 17, 18),1023(3, 11, 19, 24), (3, 11, 20, 22), (3, 11, 27, 34), (3, 11, 31, 37),1024(3, 11, 32, 35), (3, 12, 14, 33), (3, 12, 16, 26), (3, 12, 17, 21),1025(3, 12, 18, 28), (3, 12, 19, 29), (3, 12, 22, 31), (3, 12, 25, 27),1026(3, 12, 30, 34), (3, 12, 35, 37), (3, 13, 15, 18), (3, 13, 16, 29),1027(3, 13, 17, 19), (3, 13, 22, 32), (3, 13, 25, 34), (3, 13, 26, 35),1028(3, 13, 28, 37), (3, 13, 31, 36), (3, 14, 15, 19), (3, 14, 17, 27),1029(3, 14, 18, 29), (3, 14, 20, 34), (3, 14, 22, 24), (3, 14, 26, 37),1030(3, 14, 30, 32), (3, 14, 35, 36), (3, 15, 20, 23), (3, 15, 24, 31),1031(3, 15, 25, 28), (3, 15, 26, 30), (3, 15, 29, 32), (3, 15, 33, 36),1032(3, 15, 34, 37), (3, 16, 17, 36), (3, 16, 18, 32), (3, 16, 19, 27),1033(3, 16, 20, 24), (3, 16, 21, 37), (3, 16, 22, 35), (3, 16, 25, 31),1034(3, 17, 20, 29), (3, 17, 22, 23), (3, 17, 24, 35), (3, 17, 28, 31),1035(3, 17, 30, 33), (3, 18, 20, 26), (3, 18, 21, 23), (3, 18, 22, 37),1036(3, 18, 27, 31), (3, 18, 33, 35), (3, 19, 20, 35), (3, 19, 21, 30),1037(3, 19, 22, 34), (3, 19, 23, 36), (3, 19, 26, 33), (3, 20, 27, 30),1038(3, 20, 28, 36), (3, 20, 33, 37), (3, 21, 24, 29), (3, 21, 25, 32),1039(3, 21, 26, 31), (3, 21, 28, 34), (3, 22, 25, 29), (3, 23, 24, 34),1040(3, 23, 26, 27), (3, 23, 29, 33), (3, 23, 31, 35), (3, 23, 32, 37),1041(3, 24, 25, 30), (3, 24, 27, 33), (3, 25, 36, 37), (3, 26, 28, 32),1042(3, 27, 28, 29), (3, 29, 30, 36), (3, 31, 33, 34), (3, 32, 34, 36),1043(4, 5, 6, 18), (4, 5, 8, 35), (4, 5, 9, 31), (4, 5, 10, 21), (4, 5, 11, 16),1044(4, 5, 13, 14), (4, 5, 15, 22), (4, 5, 20, 26), (4, 5, 23, 37), (4, 5, 24, 29),1045(4, 5, 25, 27), (4, 5, 28, 36), (4, 5, 30, 32), (4, 5, 33, 34), (4, 6, 7, 14),1046(4, 6, 8, 13), (4, 6, 9, 32), (4, 6, 10, 19), (4, 6, 12, 27), (4, 6, 15, 26),1047(4, 6, 16, 17), (4, 6, 20, 29), (4, 6, 21, 22), (4, 6, 23, 34), (4, 6, 25, 33),1048(4, 6, 30, 35), (4, 6, 31, 36), (4, 7, 8, 22), (4, 7, 9, 27), (4, 7, 10, 36),1049(4, 7, 11, 23), (4, 7, 12, 24), (4, 7, 13, 21), (4, 7, 15, 29), (4, 7, 16, 28),1050(4, 7, 17, 31), (4, 7, 18, 35), (4, 7, 19, 26), (4, 7, 20, 32), (4, 7, 25, 37),1051(4, 8, 9, 11), (4, 8, 10, 32), (4, 8, 12, 29), (4, 8, 14, 34), (4, 8, 15, 24),1052(4, 8, 16, 36), (4, 8, 18, 33), (4, 8, 19, 31), (4, 8, 21, 26), (4, 8, 23, 27),1053(4, 8, 28, 37), (4, 9, 10, 28), (4, 9, 12, 30), (4, 9, 13, 33), (4, 9, 14, 24),1054(4, 9, 15, 17), (4, 9, 16, 18), (4, 9, 19, 37), (4, 9, 22, 23), (4, 9, 25, 29),1055(4, 9, 26, 34), (4, 9, 35, 36), (4, 10, 11, 34), (4, 10, 12, 37),1056(4, 10, 13, 16), (4, 10, 14, 22), (4, 10, 17, 35), (4, 10, 20, 33),1057(4, 10, 23, 29), (4, 10, 24, 31), (4, 10, 26, 27), (4, 11, 12, 15),1058(4, 11, 13, 37), (4, 11, 14, 25), (4, 11, 17, 24), (4, 11, 18, 26),1059(4, 11, 19, 35), (4, 11, 21, 33), (4, 11, 22, 28), (4, 11, 27, 30),1060(4, 11, 29, 36), (4, 11, 31, 32), (4, 12, 14, 31), (4, 12, 16, 22),1061(4, 12, 17, 34), (4, 12, 18, 19), (4, 12, 20, 25), (4, 12, 21, 23),1062(4, 12, 28, 35), (4, 12, 33, 36), (4, 13, 15, 34), (4, 13, 17, 27),1063(4, 13, 18, 22), (4, 13, 19, 29), (4, 13, 20, 30), (4, 13, 23, 32),1064(4, 13, 26, 28), (4, 13, 31, 35), (4, 14, 16, 19), (4, 14, 17, 30),1065(4, 14, 18, 20), (4, 14, 23, 33), (4, 14, 26, 35), (4, 14, 27, 36),1066(4, 14, 32, 37), (4, 15, 16, 20), (4, 15, 18, 28), (4, 15, 19, 30),1067(4, 15, 21, 35), (4, 15, 23, 25), (4, 15, 31, 33), (4, 15, 36, 37),1068(4, 16, 21, 24), (4, 16, 25, 32), (4, 16, 26, 29), (4, 16, 27, 31),1069(4, 16, 30, 33), (4, 16, 34, 37), (4, 17, 18, 37), (4, 17, 19, 33),1070(4, 17, 20, 28), (4, 17, 21, 25), (4, 17, 23, 36), (4, 17, 26, 32),1071(4, 18, 21, 30), (4, 18, 23, 24), (4, 18, 25, 36), (4, 18, 29, 32),1072(4, 18, 31, 34), (4, 19, 21, 27), (4, 19, 22, 24), (4, 19, 28, 32),1073(4, 19, 34, 36), (4, 20, 21, 36), (4, 20, 22, 31), (4, 20, 23, 35),1074(4, 20, 24, 37), (4, 20, 27, 34), (4, 21, 28, 31), (4, 21, 29, 37),1075(4, 22, 25, 30), (4, 22, 26, 33), (4, 22, 27, 32), (4, 22, 29, 35),1076(4, 23, 26, 30), (4, 24, 25, 35), (4, 24, 27, 28), (4, 24, 30, 34),1077(4, 24, 32, 36), (4, 25, 26, 31), (4, 25, 28, 34), (4, 27, 29, 33),1078(4, 28, 29, 30), (4, 30, 31, 37), (4, 32, 34, 35), (4, 33, 35, 37),1079(5, 6, 7, 19), (5, 6, 9, 36), (5, 6, 10, 32), (5, 6, 11, 22), (5, 6, 12, 17),1080(5, 6, 14, 15), (5, 6, 16, 23), (5, 6, 21, 27), (5, 6, 25, 30), (5, 6, 26, 28),1081(5, 6, 29, 37), (5, 6, 31, 33), (5, 6, 34, 35), (5, 7, 8, 15), (5, 7, 9, 14),1082(5, 7, 10, 33), (5, 7, 11, 20), (5, 7, 13, 28), (5, 7, 16, 27), (5, 7, 17, 18),1083(5, 7, 21, 30), (5, 7, 22, 23), (5, 7, 24, 35), (5, 7, 26, 34), (5, 7, 31, 36),1084(5, 7, 32, 37), (5, 8, 9, 23), (5, 8, 10, 28), (5, 8, 11, 37), (5, 8, 12, 24),1085(5, 8, 13, 25), (5, 8, 14, 22), (5, 8, 16, 30), (5, 8, 17, 29), (5, 8, 18, 32),1086(5, 8, 19, 36), (5, 8, 20, 27), (5, 8, 21, 33), (5, 9, 10, 12), (5, 9, 11, 33),1087(5, 9, 13, 30), (5, 9, 15, 35), (5, 9, 16, 25), (5, 9, 17, 37), (5, 9, 19, 34),1088(5, 9, 20, 32), (5, 9, 22, 27), (5, 9, 24, 28), (5, 10, 11, 29),1089(5, 10, 13, 31), (5, 10, 14, 34), (5, 10, 15, 25), (5, 10, 16, 18),1090(5, 10, 17, 19), (5, 10, 23, 24), (5, 10, 26, 30), (5, 10, 27, 35),1091(5, 10, 36, 37), (5, 11, 12, 35), (5, 11, 14, 17), (5, 11, 15, 23),1092(5, 11, 18, 36), (5, 11, 21, 34), (5, 11, 24, 30), (5, 11, 25, 32),1093(5, 11, 27, 28), (5, 12, 13, 16), (5, 12, 15, 26), (5, 12, 18, 25),1094(5, 12, 19, 27), (5, 12, 20, 36), (5, 12, 22, 34), (5, 12, 23, 29),1095(5, 12, 28, 31), (5, 12, 30, 37), (5, 12, 32, 33), (5, 13, 15, 32),1096(5, 13, 17, 23), (5, 13, 18, 35), (5, 13, 19, 20), (5, 13, 21, 26),1097(5, 13, 22, 24), (5, 13, 29, 36), (5, 13, 34, 37), (5, 14, 16, 35),1098(5, 14, 18, 28), (5, 14, 19, 23), (5, 14, 20, 30), (5, 14, 21, 31),1099(5, 14, 24, 33), (5, 14, 27, 29), (5, 14, 32, 36), (5, 15, 17, 20),1100(5, 15, 18, 31), (5, 15, 19, 21), (5, 15, 24, 34), (5, 15, 27, 36),1101(5, 15, 28, 37), (5, 16, 17, 21), (5, 16, 19, 29), (5, 16, 20, 31),1102(5, 16, 22, 36), (5, 16, 24, 26), (5, 16, 32, 34), (5, 17, 22, 25),1103(5, 17, 26, 33), (5, 17, 27, 30), (5, 17, 28, 32), (5, 17, 31, 34),1104(5, 18, 20, 34), (5, 18, 21, 29), (5, 18, 22, 26), (5, 18, 24, 37),1105(5, 18, 27, 33), (5, 19, 22, 31), (5, 19, 24, 25), (5, 19, 26, 37),1106(5, 19, 30, 33), (5, 19, 32, 35), (5, 20, 22, 28), (5, 20, 23, 25),1107(5, 20, 29, 33), (5, 20, 35, 37), (5, 21, 22, 37), (5, 21, 23, 32),1108(5, 21, 24, 36), (5, 21, 28, 35), (5, 22, 29, 32), (5, 23, 26, 31),1109(5, 23, 27, 34), (5, 23, 28, 33), (5, 23, 30, 36), (5, 24, 27, 31),1110(5, 25, 26, 36), (5, 25, 28, 29), (5, 25, 31, 35), (5, 25, 33, 37),1111(5, 26, 27, 32), (5, 26, 29, 35), (5, 28, 30, 34), (5, 29, 30, 31),1112(5, 33, 35, 36), (6, 7, 8, 20), (6, 7, 10, 37), (6, 7, 11, 33), (6, 7, 12, 23),1113(6, 7, 13, 18), (6, 7, 15, 16), (6, 7, 17, 24), (6, 7, 22, 28), (6, 7, 26, 31),1114(6, 7, 27, 29), (6, 7, 32, 34), (6, 7, 35, 36), (6, 8, 9, 16), (6, 8, 10, 15),1115(6, 8, 11, 34), (6, 8, 12, 21), (6, 8, 14, 29), (6, 8, 17, 28), (6, 8, 18, 19),1116(6, 8, 22, 31), (6, 8, 23, 24), (6, 8, 25, 36), (6, 8, 27, 35), (6, 8, 32, 37),1117(6, 9, 10, 24), (6, 9, 11, 29), (6, 9, 13, 25), (6, 9, 14, 26), (6, 9, 15, 23),1118(6, 9, 17, 31), (6, 9, 18, 30), (6, 9, 19, 33), (6, 9, 20, 37), (6, 9, 21, 28),1119(6, 9, 22, 34), (6, 10, 11, 13), (6, 10, 12, 34), (6, 10, 14, 31),1120(6, 10, 16, 36), (6, 10, 17, 26), (6, 10, 20, 35), (6, 10, 21, 33),1121(6, 10, 23, 28), (6, 10, 25, 29), (6, 11, 12, 30), (6, 11, 14, 32),1122(6, 11, 15, 35), (6, 11, 16, 26), (6, 11, 17, 19), (6, 11, 18, 20),1123(6, 11, 24, 25), (6, 11, 27, 31), (6, 11, 28, 36), (6, 12, 13, 36),1124(6, 12, 15, 18), (6, 12, 16, 24), (6, 12, 19, 37), (6, 12, 22, 35),1125(6, 12, 25, 31), (6, 12, 26, 33), (6, 12, 28, 29), (6, 13, 14, 17),1126(6, 13, 16, 27), (6, 13, 19, 26), (6, 13, 20, 28), (6, 13, 21, 37),1127(6, 13, 23, 35), (6, 13, 24, 30), (6, 13, 29, 32), (6, 13, 33, 34),1128(6, 14, 16, 33), (6, 14, 18, 24), (6, 14, 19, 36), (6, 14, 20, 21),1129(6, 14, 22, 27), (6, 14, 23, 25), (6, 14, 30, 37), (6, 15, 17, 36),1130(6, 15, 19, 29), (6, 15, 20, 24), (6, 15, 21, 31), (6, 15, 22, 32),1131(6, 15, 25, 34), (6, 15, 28, 30), (6, 15, 33, 37), (6, 16, 18, 21),1132(6, 16, 19, 32), (6, 16, 20, 22), (6, 16, 25, 35), (6, 16, 28, 37),1133(6, 17, 18, 22), (6, 17, 20, 30), (6, 17, 21, 32), (6, 17, 23, 37),1134(6, 17, 25, 27), (6, 17, 33, 35), (6, 18, 23, 26), (6, 18, 27, 34),1135(6, 18, 28, 31), (6, 18, 29, 33), (6, 18, 32, 35), (6, 19, 21, 35),1136(6, 19, 22, 30), (6, 19, 23, 27), (6, 19, 28, 34), (6, 20, 23, 32),1137(6, 20, 25, 26), (6, 20, 31, 34), (6, 20, 33, 36), (6, 21, 23, 29),1138(6, 21, 24, 26), (6, 21, 30, 34), (6, 22, 24, 33), (6, 22, 25, 37),1139(6, 22, 29, 36), (6, 23, 30, 33), (6, 24, 27, 32), (6, 24, 28, 35),1140(6, 24, 29, 34), (6, 24, 31, 37), (6, 25, 28, 32), (6, 26, 27, 37),1141(6, 26, 29, 30), (6, 26, 32, 36), (6, 27, 28, 33), (6, 27, 30, 36),1142(6, 29, 31, 35), (6, 30, 31, 32), (6, 34, 36, 37), (7, 8, 9, 21),1143(7, 8, 12, 34), (7, 8, 13, 24), (7, 8, 14, 19), (7, 8, 16, 17), (7, 8, 18, 25),1144(7, 8, 23, 29), (7, 8, 27, 32), (7, 8, 28, 30), (7, 8, 33, 35), (7, 8, 36, 37),1145(7, 9, 10, 17), (7, 9, 11, 16), (7, 9, 12, 35), (7, 9, 13, 22), (7, 9, 15, 30),1146(7, 9, 18, 29), (7, 9, 19, 20), (7, 9, 23, 32), (7, 9, 24, 25), (7, 9, 26, 37),1147(7, 9, 28, 36), (7, 10, 11, 25), (7, 10, 12, 30), (7, 10, 14, 26),1148(7, 10, 15, 27), (7, 10, 16, 24), (7, 10, 18, 32), (7, 10, 19, 31),1149(7, 10, 20, 34), (7, 10, 22, 29), (7, 10, 23, 35), (7, 11, 12, 14),1150(7, 11, 13, 35), (7, 11, 15, 32), (7, 11, 17, 37), (7, 11, 18, 27),1151(7, 11, 21, 36), (7, 11, 22, 34), (7, 11, 24, 29), (7, 11, 26, 30),1152(7, 12, 13, 31), (7, 12, 15, 33), (7, 12, 16, 36), (7, 12, 17, 27),1153(7, 12, 18, 20), (7, 12, 19, 21), (7, 12, 25, 26), (7, 12, 28, 32),1154(7, 12, 29, 37), (7, 13, 14, 37), (7, 13, 16, 19), (7, 13, 17, 25),1155(7, 13, 23, 36), (7, 13, 26, 32), (7, 13, 27, 34), (7, 13, 29, 30),1156(7, 14, 15, 18), (7, 14, 17, 28), (7, 14, 20, 27), (7, 14, 21, 29),1157(7, 14, 24, 36), (7, 14, 25, 31), (7, 14, 30, 33), (7, 14, 34, 35),1158(7, 15, 17, 34), (7, 15, 19, 25), (7, 15, 20, 37), (7, 15, 21, 22),1159(7, 15, 23, 28), (7, 15, 24, 26), (7, 16, 18, 37), (7, 16, 20, 30),1160(7, 16, 21, 25), (7, 16, 22, 32), (7, 16, 23, 33), (7, 16, 26, 35),1161(7, 16, 29, 31), (7, 17, 19, 22), (7, 17, 20, 33), (7, 17, 21, 23),1162(7, 17, 26, 36), (7, 18, 19, 23), (7, 18, 21, 31), (7, 18, 22, 33),1163(7, 18, 26, 28), (7, 18, 34, 36), (7, 19, 24, 27), (7, 19, 28, 35),1164(7, 19, 29, 32), (7, 19, 30, 34), (7, 19, 33, 36), (7, 20, 22, 36),1165(7, 20, 23, 31), (7, 20, 24, 28), (7, 20, 29, 35), (7, 21, 24, 33),1166(7, 21, 26, 27), (7, 21, 32, 35), (7, 21, 34, 37), (7, 22, 24, 30),1167(7, 22, 25, 27), (7, 22, 31, 35), (7, 23, 25, 34), (7, 23, 30, 37),1168(7, 24, 31, 34), (7, 25, 28, 33), (7, 25, 29, 36), (7, 25, 30, 35),1169(7, 26, 29, 33), (7, 27, 30, 31), (7, 27, 33, 37), (7, 28, 29, 34),1170(7, 28, 31, 37), (7, 30, 32, 36), (7, 31, 32, 33), (8, 9, 10, 22),1171(8, 9, 13, 35), (8, 9, 14, 25), (8, 9, 15, 20), (8, 9, 17, 18), (8, 9, 19, 26),1172(8, 9, 24, 30), (8, 9, 28, 33), (8, 9, 29, 31), (8, 9, 34, 36), (8, 10, 11, 18),1173(8, 10, 12, 17), (8, 10, 13, 36), (8, 10, 14, 23), (8, 10, 16, 31),1174(8, 10, 19, 30), (8, 10, 20, 21), (8, 10, 24, 33), (8, 10, 25, 26),1175(8, 10, 29, 37), (8, 11, 12, 26), (8, 11, 13, 31), (8, 11, 15, 27),1176(8, 11, 16, 28), (8, 11, 17, 25), (8, 11, 19, 33), (8, 11, 20, 32),1177(8, 11, 21, 35), (8, 11, 23, 30), (8, 11, 24, 36), (8, 12, 13, 15),1178(8, 12, 14, 36), (8, 12, 16, 33), (8, 12, 19, 28), (8, 12, 22, 37),1179(8, 12, 23, 35), (8, 12, 25, 30), (8, 12, 27, 31), (8, 13, 14, 32),1180(8, 13, 16, 34), (8, 13, 17, 37), (8, 13, 18, 28), (8, 13, 19, 21),1181(8, 13, 20, 22), (8, 13, 26, 27), (8, 13, 29, 33), (8, 14, 17, 20),1182(8, 14, 18, 26), (8, 14, 24, 37), (8, 14, 27, 33), (8, 14, 28, 35),1183(8, 14, 30, 31), (8, 15, 16, 19), (8, 15, 18, 29), (8, 15, 21, 28),1184(8, 15, 22, 30), (8, 15, 25, 37), (8, 15, 26, 32), (8, 15, 31, 34),1185(8, 15, 35, 36), (8, 16, 18, 35), (8, 16, 20, 26), (8, 16, 22, 23),1186(8, 16, 24, 29), (8, 16, 25, 27), (8, 17, 21, 31), (8, 17, 22, 26),1187(8, 17, 23, 33), (8, 17, 24, 34), (8, 17, 27, 36), (8, 17, 30, 32),1188(8, 18, 20, 23), (8, 18, 21, 34), (8, 18, 22, 24), (8, 18, 27, 37),1189(8, 19, 20, 24), (8, 19, 22, 32), (8, 19, 23, 34), (8, 19, 27, 29),1190(8, 19, 35, 37), (8, 20, 25, 28), (8, 20, 29, 36), (8, 20, 30, 33),1191(8, 20, 31, 35), (8, 20, 34, 37), (8, 21, 23, 37), (8, 21, 24, 32),1192(8, 21, 25, 29), (8, 21, 30, 36), (8, 22, 25, 34), (8, 22, 27, 28),1193(8, 22, 33, 36), (8, 23, 25, 31), (8, 23, 26, 28), (8, 23, 32, 36),1194(8, 24, 26, 35), (8, 25, 32, 35), (8, 26, 29, 34), (8, 26, 30, 37),1195(8, 26, 31, 36), (8, 27, 30, 34), (8, 28, 31, 32), (8, 29, 30, 35),1196(8, 31, 33, 37), (8, 32, 33, 34), (9, 10, 11, 23), (9, 10, 14, 36),1197(9, 10, 15, 26), (9, 10, 16, 21), (9, 10, 18, 19), (9, 10, 20, 27),1198(9, 10, 25, 31), (9, 10, 29, 34), (9, 10, 30, 32), (9, 10, 35, 37),1199(9, 11, 12, 19), (9, 11, 13, 18), (9, 11, 14, 37), (9, 11, 15, 24),1200(9, 11, 17, 32), (9, 11, 20, 31), (9, 11, 21, 22), (9, 11, 25, 34),1201(9, 11, 26, 27), (9, 12, 13, 27), (9, 12, 14, 32), (9, 12, 16, 28),1202(9, 12, 17, 29), (9, 12, 18, 26), (9, 12, 20, 34), (9, 12, 21, 33),1203(9, 12, 22, 36), (9, 12, 24, 31), (9, 12, 25, 37), (9, 13, 14, 16),1204(9, 13, 15, 37), (9, 13, 17, 34), (9, 13, 20, 29), (9, 13, 24, 36),1205(9, 13, 26, 31), (9, 13, 28, 32), (9, 14, 15, 33), (9, 14, 17, 35),1206(9, 14, 19, 29), (9, 14, 20, 22), (9, 14, 21, 23), (9, 14, 27, 28),1207(9, 14, 30, 34), (9, 15, 18, 21), (9, 15, 19, 27), (9, 15, 28, 34),1208(9, 15, 29, 36), (9, 15, 31, 32), (9, 16, 17, 20), (9, 16, 19, 30),1209(9, 16, 22, 29), (9, 16, 23, 31), (9, 16, 27, 33), (9, 16, 32, 35),1210(9, 16, 36, 37), (9, 17, 19, 36), (9, 17, 21, 27), (9, 17, 23, 24),1211(9, 17, 25, 30), (9, 17, 26, 28), (9, 18, 22, 32), (9, 18, 23, 27),1212(9, 18, 24, 34), (9, 18, 25, 35), (9, 18, 28, 37), (9, 18, 31, 33),1213(9, 19, 21, 24), (9, 19, 22, 35), (9, 19, 23, 25), (9, 20, 21, 25),1214(9, 20, 23, 33), (9, 20, 24, 35), (9, 20, 28, 30), (9, 21, 26, 29),1215(9, 21, 30, 37), (9, 21, 31, 34), (9, 21, 32, 36), (9, 22, 25, 33),1216(9, 22, 26, 30), (9, 22, 31, 37), (9, 23, 26, 35), (9, 23, 28, 29),1217(9, 23, 34, 37), (9, 24, 26, 32), (9, 24, 27, 29), (9, 24, 33, 37),1218(9, 25, 27, 36), (9, 26, 33, 36), (9, 27, 30, 35), (9, 27, 32, 37),1219(9, 28, 31, 35), (9, 29, 32, 33), (9, 30, 31, 36), (9, 33, 34, 35),1220(10, 11, 12, 24), (10, 11, 15, 37), (10, 11, 16, 27), (10, 11, 17, 22),1221(10, 11, 19, 20), (10, 11, 21, 28), (10, 11, 26, 32), (10, 11, 30, 35),1222(10, 11, 31, 33), (10, 12, 13, 20), (10, 12, 14, 19), (10, 12, 16, 25),1223(10, 12, 18, 33), (10, 12, 21, 32), (10, 12, 22, 23), (10, 12, 26, 35),1224(10, 12, 27, 28), (10, 13, 14, 28), (10, 13, 15, 33), (10, 13, 17, 29),1225(10, 13, 18, 30), (10, 13, 19, 27), (10, 13, 21, 35), (10, 13, 22, 34),1226(10, 13, 23, 37), (10, 13, 25, 32), (10, 14, 15, 17), (10, 14, 18, 35),1227(10, 14, 21, 30), (10, 14, 25, 37), (10, 14, 27, 32), (10, 14, 29, 33),1228(10, 15, 16, 34), (10, 15, 18, 36), (10, 15, 20, 30), (10, 15, 21, 23),1229(10, 15, 22, 24), (10, 15, 28, 29), (10, 15, 31, 35), (10, 16, 19, 22),1230(10, 16, 20, 28), (10, 16, 29, 35), (10, 16, 30, 37), (10, 16, 32, 33),1231(10, 17, 18, 21), (10, 17, 20, 31), (10, 17, 23, 30), (10, 17, 24, 32),1232(10, 17, 28, 34), (10, 17, 33, 36), (10, 18, 20, 37), (10, 18, 22, 28),1233(10, 18, 24, 25), (10, 18, 26, 31), (10, 18, 27, 29), (10, 19, 23, 33),1234(10, 19, 24, 28), (10, 19, 25, 35), (10, 19, 26, 36), (10, 19, 32, 34),1235(10, 20, 22, 25), (10, 20, 23, 36), (10, 20, 24, 26), (10, 21, 22, 26),1236(10, 21, 24, 34), (10, 21, 25, 36), (10, 21, 29, 31), (10, 22, 27, 30),1237(10, 22, 32, 35), (10, 22, 33, 37), (10, 23, 26, 34), (10, 23, 27, 31),1238(10, 24, 27, 36), (10, 24, 29, 30), (10, 25, 27, 33), (10, 25, 28, 30),1239(10, 26, 28, 37), (10, 27, 34, 37), (10, 28, 31, 36), (10, 29, 32, 36),1240(10, 30, 33, 34), (10, 31, 32, 37), (10, 34, 35, 36), (11, 12, 13, 25),1241(11, 12, 17, 28), (11, 12, 18, 23), (11, 12, 20, 21), (11, 12, 22, 29),1242(11, 12, 27, 33), (11, 12, 31, 36), (11, 12, 32, 34), (11, 13, 14, 21),1243(11, 13, 15, 20), (11, 13, 17, 26), (11, 13, 19, 34), (11, 13, 22, 33),1244(11, 13, 23, 24), (11, 13, 27, 36), (11, 13, 28, 29), (11, 14, 15, 29),1245(11, 14, 16, 34), (11, 14, 18, 30), (11, 14, 19, 31), (11, 14, 20, 28),1246(11, 14, 22, 36), (11, 14, 23, 35), (11, 14, 26, 33), (11, 15, 16, 18),1247(11, 15, 19, 36), (11, 15, 22, 31), (11, 15, 28, 33), (11, 15, 30, 34),1248(11, 16, 17, 35), (11, 16, 19, 37), (11, 16, 21, 31), (11, 16, 22, 24),1249(11, 16, 23, 25), (11, 16, 29, 30), (11, 16, 32, 36), (11, 17, 20, 23),1250(11, 17, 21, 29), (11, 17, 30, 36), (11, 17, 33, 34), (11, 18, 19, 22),1251(11, 18, 21, 32), (11, 18, 24, 31), (11, 18, 25, 33), (11, 18, 29, 35),1252(11, 18, 34, 37), (11, 19, 23, 29), (11, 19, 25, 26), (11, 19, 27, 32),1253(11, 19, 28, 30), (11, 20, 24, 34), (11, 20, 25, 29), (11, 20, 26, 36),1254(11, 20, 27, 37), (11, 20, 33, 35), (11, 21, 23, 26), (11, 21, 24, 37),1255(11, 21, 25, 27), (11, 22, 23, 27), (11, 22, 25, 35), (11, 22, 26, 37),1256(11, 22, 30, 32), (11, 23, 28, 31), (11, 23, 33, 36), (11, 24, 27, 35),1257(11, 24, 28, 32), (11, 25, 28, 37), (11, 25, 30, 31), (11, 26, 28, 34),1258(11, 26, 29, 31), (11, 29, 32, 37), (11, 30, 33, 37), (11, 31, 34, 35),1259(11, 35, 36, 37), (12, 13, 14, 26), (12, 13, 18, 29), (12, 13, 19, 24),1260(12, 13, 21, 22), (12, 13, 23, 30), (12, 13, 28, 34), (12, 13, 32, 37),1261(12, 13, 33, 35), (12, 14, 15, 22), (12, 14, 16, 21), (12, 14, 18, 27),1262(12, 14, 20, 35), (12, 14, 23, 34), (12, 14, 24, 25), (12, 14, 28, 37),1263(12, 14, 29, 30), (12, 15, 16, 30), (12, 15, 17, 35), (12, 15, 19, 31),1264(12, 15, 20, 32), (12, 15, 21, 29), (12, 15, 23, 37), (12, 15, 24, 36),1265(12, 15, 27, 34), (12, 16, 17, 19), (12, 16, 20, 37), (12, 16, 23, 32),1266(12, 16, 29, 34), (12, 16, 31, 35), (12, 17, 18, 36), (12, 17, 22, 32),1267(12, 17, 23, 25), (12, 17, 24, 26), (12, 17, 30, 31), (12, 17, 33, 37),1268(12, 18, 21, 24), (12, 18, 22, 30), (12, 18, 31, 37), (12, 18, 34, 35),1269(12, 19, 20, 23), (12, 19, 22, 33), (12, 19, 25, 32), (12, 19, 26, 34),1270(12, 19, 30, 36), (12, 20, 24, 30), (12, 20, 26, 27), (12, 20, 28, 33),1271(12, 20, 29, 31), (12, 21, 25, 35), (12, 21, 26, 30), (12, 21, 27, 37),1272(12, 21, 34, 36), (12, 22, 24, 27), (12, 22, 26, 28), (12, 23, 24, 28),1273(12, 23, 26, 36), (12, 23, 31, 33), (12, 24, 29, 32), (12, 24, 34, 37),1274(12, 25, 28, 36), (12, 25, 29, 33), (12, 26, 31, 32), (12, 27, 29, 35),1275(12, 27, 30, 32), (12, 32, 35, 36), (13, 14, 15, 27), (13, 14, 19, 30),1276(13, 14, 20, 25), (13, 14, 22, 23), (13, 14, 24, 31), (13, 14, 29, 35),1277(13, 14, 34, 36), (13, 15, 16, 23), (13, 15, 17, 22), (13, 15, 19, 28),1278(13, 15, 21, 36), (13, 15, 24, 35), (13, 15, 25, 26), (13, 15, 30, 31),1279(13, 16, 17, 31), (13, 16, 18, 36), (13, 16, 20, 32), (13, 16, 21, 33),1280(13, 16, 22, 30), (13, 16, 25, 37), (13, 16, 28, 35), (13, 17, 18, 20),1281(13, 17, 24, 33), (13, 17, 30, 35), (13, 17, 32, 36), (13, 18, 19, 37),1282(13, 18, 23, 33), (13, 18, 24, 26), (13, 18, 25, 27), (13, 18, 31, 32),1283(13, 19, 22, 25), (13, 19, 23, 31), (13, 19, 35, 36), (13, 20, 21, 24),1284(13, 20, 23, 34), (13, 20, 26, 33), (13, 20, 27, 35), (13, 20, 31, 37),1285(13, 21, 25, 31), (13, 21, 27, 28), (13, 21, 29, 34), (13, 21, 30, 32),1286(13, 22, 26, 36), (13, 22, 27, 31), (13, 22, 35, 37), (13, 23, 25, 28),1287(13, 23, 27, 29), (13, 24, 25, 29), (13, 24, 27, 37), (13, 24, 32, 34),1288(13, 25, 30, 33), (13, 26, 29, 37), (13, 26, 30, 34), (13, 27, 32, 33),1289(13, 28, 30, 36), (13, 28, 31, 33), (13, 33, 36, 37), (14, 15, 16, 28),1290(14, 15, 20, 31), (14, 15, 21, 26), (14, 15, 23, 24), (14, 15, 25, 32),1291(14, 15, 30, 36), (14, 15, 35, 37), (14, 16, 17, 24), (14, 16, 18, 23),1292(14, 16, 20, 29), (14, 16, 22, 37), (14, 16, 25, 36), (14, 16, 26, 27),1293(14, 16, 31, 32), (14, 17, 18, 32), (14, 17, 19, 37), (14, 17, 21, 33),1294(14, 17, 22, 34), (14, 17, 23, 31), (14, 17, 29, 36), (14, 18, 19, 21),1295(14, 18, 25, 34), (14, 18, 31, 36), (14, 18, 33, 37), (14, 19, 24, 34),1296(14, 19, 25, 27), (14, 19, 26, 28), (14, 19, 32, 33), (14, 20, 23, 26),1297(14, 20, 24, 32), (14, 20, 36, 37), (14, 21, 22, 25), (14, 21, 24, 35),1298(14, 21, 27, 34), (14, 21, 28, 36), (14, 22, 26, 32), (14, 22, 28, 29),1299(14, 22, 30, 35), (14, 22, 31, 33), (14, 23, 27, 37), (14, 23, 28, 32),1300(14, 24, 26, 29), (14, 24, 28, 30), (14, 25, 26, 30), (14, 25, 33, 35),1301(14, 26, 31, 34), (14, 27, 31, 35), (14, 28, 33, 34), (14, 29, 31, 37),1302(14, 29, 32, 34), (15, 16, 17, 29), (15, 16, 21, 32), (15, 16, 22, 27),1303(15, 16, 24, 25), (15, 16, 26, 33), (15, 16, 31, 37), (15, 17, 18, 25),1304(15, 17, 19, 24), (15, 17, 21, 30), (15, 17, 26, 37), (15, 17, 27, 28),1305(15, 17, 32, 33), (15, 18, 19, 33), (15, 18, 22, 34), (15, 18, 23, 35),1306(15, 18, 24, 32), (15, 18, 30, 37), (15, 19, 20, 22), (15, 19, 26, 35),1307(15, 19, 32, 37), (15, 20, 25, 35), (15, 20, 26, 28), (15, 20, 27, 29),1308(15, 20, 33, 34), (15, 21, 24, 27), (15, 21, 25, 33), (15, 22, 23, 26),1309(15, 22, 25, 36), (15, 22, 28, 35), (15, 22, 29, 37), (15, 23, 27, 33),1310(15, 23, 29, 30), (15, 23, 31, 36), (15, 23, 32, 34), (15, 24, 29, 33),1311(15, 25, 27, 30), (15, 25, 29, 31), (15, 26, 27, 31), (15, 26, 34, 36),1312(15, 27, 32, 35), (15, 28, 32, 36), (15, 29, 34, 35), (15, 30, 33, 35),1313(16, 17, 18, 30), (16, 17, 22, 33), (16, 17, 23, 28), (16, 17, 25, 26),1314(16, 17, 27, 34), (16, 18, 19, 26), (16, 18, 20, 25), (16, 18, 22, 31),1315(16, 18, 28, 29), (16, 18, 33, 34), (16, 19, 20, 34), (16, 19, 23, 35),1316(16, 19, 24, 36), (16, 19, 25, 33), (16, 20, 21, 23), (16, 20, 27, 36),1317(16, 21, 26, 36), (16, 21, 27, 29), (16, 21, 28, 30), (16, 21, 34, 35),1318(16, 22, 25, 28), (16, 22, 26, 34), (16, 23, 24, 27), (16, 23, 26, 37),1319(16, 23, 29, 36), (16, 24, 28, 34), (16, 24, 30, 31), (16, 24, 32, 37),1320(16, 24, 33, 35), (16, 25, 30, 34), (16, 26, 28, 31), (16, 26, 30, 32),1321(16, 27, 28, 32), (16, 27, 35, 37), (16, 28, 33, 36), (16, 29, 33, 37),1322(16, 30, 35, 36), (16, 31, 34, 36), (17, 18, 19, 31), (17, 18, 23, 34),1323(17, 18, 24, 29), (17, 18, 26, 27), (17, 18, 28, 35), (17, 19, 20, 27),1324(17, 19, 21, 26), (17, 19, 23, 32), (17, 19, 29, 30), (17, 19, 34, 35),1325(17, 20, 21, 35), (17, 20, 24, 36), (17, 20, 25, 37), (17, 20, 26, 34),1326(17, 21, 22, 24), (17, 21, 28, 37), (17, 22, 27, 37), (17, 22, 28, 30),1327(17, 22, 29, 31), (17, 22, 35, 36), (17, 23, 26, 29), (17, 23, 27, 35),1328(17, 24, 25, 28), (17, 24, 30, 37), (17, 25, 29, 35), (17, 25, 31, 32),1329(17, 25, 34, 36), (17, 26, 31, 35), (17, 27, 29, 32), (17, 27, 31, 33),1330(17, 28, 29, 33), (17, 29, 34, 37), (17, 31, 36, 37), (17, 32, 35, 37),1331(18, 19, 20, 32), (18, 19, 24, 35), (18, 19, 25, 30), (18, 19, 27, 28),1332(18, 19, 29, 36), (18, 20, 21, 28), (18, 20, 22, 27), (18, 20, 24, 33),1333(18, 20, 30, 31), (18, 20, 35, 36), (18, 21, 22, 36), (18, 21, 25, 37),1334(18, 21, 27, 35), (18, 22, 23, 25), (18, 23, 29, 31), (18, 23, 30, 32),1335(18, 23, 36, 37), (18, 24, 27, 30), (18, 24, 28, 36), (18, 25, 26, 29),1336(18, 26, 30, 36), (18, 26, 32, 33), (18, 26, 35, 37), (18, 27, 32, 36),1337(18, 28, 30, 33), (18, 28, 32, 34), (18, 29, 30, 34), (19, 20, 21, 33),1338(19, 20, 25, 36), (19, 20, 26, 31), (19, 20, 28, 29), (19, 20, 30, 37),1339(19, 21, 22, 29), (19, 21, 23, 28), (19, 21, 25, 34), (19, 21, 31, 32),1340(19, 21, 36, 37), (19, 22, 23, 37), (19, 22, 28, 36), (19, 23, 24, 26),1341(19, 24, 30, 32), (19, 24, 31, 33), (19, 25, 28, 31), (19, 25, 29, 37),1342(19, 26, 27, 30), (19, 27, 31, 37), (19, 27, 33, 34), (19, 28, 33, 37),1343(19, 29, 31, 34), (19, 29, 33, 35), (19, 30, 31, 35), (20, 21, 22, 34),1344(20, 21, 26, 37), (20, 21, 27, 32), (20, 21, 29, 30), (20, 22, 23, 30),1345(20, 22, 24, 29), (20, 22, 26, 35), (20, 22, 32, 33), (20, 23, 29, 37),1346(20, 24, 25, 27), (20, 25, 31, 33), (20, 25, 32, 34), (20, 26, 29, 32),1347(20, 27, 28, 31), (20, 28, 34, 35), (20, 30, 32, 35), (20, 30, 34, 36),1348(20, 31, 32, 36), (21, 22, 23, 35), (21, 22, 28, 33), (21, 22, 30, 31),1349(21, 23, 24, 31), (21, 23, 25, 30), (21, 23, 27, 36), (21, 23, 33, 34),1350(21, 25, 26, 28), (21, 26, 32, 34), (21, 26, 33, 35), (21, 27, 30, 33),1351(21, 28, 29, 32), (21, 29, 35, 36), (21, 31, 33, 36), (21, 31, 35, 37),1352(21, 32, 33, 37), (22, 23, 24, 36), (22, 23, 29, 34), (22, 23, 31, 32),1353(22, 24, 25, 32), (22, 24, 26, 31), (22, 24, 28, 37), (22, 24, 34, 35),1354(22, 26, 27, 29), (22, 27, 33, 35), (22, 27, 34, 36), (22, 28, 31, 34),1355(22, 29, 30, 33), (22, 30, 36, 37), (22, 32, 34, 37), (23, 24, 25, 37),1356(23, 24, 30, 35), (23, 24, 32, 33), (23, 25, 26, 33), (23, 25, 27, 32),1357(23, 25, 35, 36), (23, 27, 28, 30), (23, 28, 34, 36), (23, 28, 35, 37),1358(23, 29, 32, 35), (23, 30, 31, 34), (24, 25, 31, 36), (24, 25, 33, 34),1359(24, 26, 27, 34), (24, 26, 28, 33), (24, 26, 36, 37), (24, 28, 29, 31),1360(24, 29, 35, 37), (24, 30, 33, 36), (24, 31, 32, 35), (25, 26, 32, 37),1361(25, 26, 34, 35), (25, 27, 28, 35), (25, 27, 29, 34), (25, 29, 30, 32),1362(25, 31, 34, 37), (25, 32, 33, 36), (26, 27, 35, 36), (26, 28, 29, 36),1363(26, 28, 30, 35), (26, 30, 31, 33), (26, 33, 34, 37), (27, 28, 36, 37),1364(27, 29, 30, 37), (27, 29, 31, 36), (27, 31, 32, 34), (28, 30, 32, 37),1365(28, 32, 33, 35), (29, 33, 34, 36), (30, 34, 35, 37))136613671368