﻿def sortTri(z,L):
	#sorts triangulations into folder based on which isomorphism class their dual graph is contained in.
	zReps=open("zReps.txt", 'r')
	for line in zReps:
		strippedLine=line.rstrip('\n')
		num = './g4T2Buckets/numG_'+strippedLine+'.txt'
		tri = './g4T2Buckets/triG_'+strippedLine+'.txt'
		numFile=open(num, 'r')
		triFile=open(tri, 'ab')
		for x in numFile:
			strippedx=x.rstrip('\n')
			intStrippedx=int(strippedx)
			if intStrippedx==z:
				triFile.write(str(L)+'\n')
				break
		numFile.close()
		triFile.close()

sortTri(0,[[0,1,2],[1,2,3],[0,1,3],[3,7,8],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[2,3,6],[3,6,7],[2,5,6],[5,6,7]])
sortTri(1,[[0,1,2],[1,2,3],[0,1,3],[3,7,8],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[2,3,6],[3,6,7],[2,5,7],[2,6,7]])
sortTri(2,[[0,1,2],[1,2,3],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[2,3,6],[6,7,8],[3,6,8],[2,5,6],[5,6,7]])
sortTri(3,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[1,3,6],[1,2,6],[6,7,8],[3,6,8],[2,5,6],[5,6,7]])
sortTri(4,[[0,1,2],[1,2,3],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[2,3,6],[3,6,8],[2,5,6],[5,7,8],[5,6,8]])
sortTri(5,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[1,3,6],[1,2,6],[3,6,8],[2,5,6],[5,7,8],[5,6,8]])
sortTri(6,[[0,1,2],[1,2,3],[0,1,3],[3,8,9],[2,4,5],[4,5,7],[2,3,6],[3,6,8],[2,5,6],[5,6,8],[5,8,9],[5,7,9]])
sortTri(7,[[0,1,2],[0,1,3],[3,8,9],[2,4,5],[4,5,7],[1,3,6],[1,2,6],[3,6,8],[2,5,6],[5,6,8],[5,8,9],[5,7,9]])
sortTri(8,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[4,5,7],[1,2,6],[2,5,6],[5,7,8],[5,6,8],[1,3,8],[1,6,8]])
sortTri(9,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[2,4,5],[1,2,6],[2,5,6],[5,6,8],[1,3,8],[1,6,8],[4,7,8],[4,5,8]])
sortTri(10,[[0,1,2],[0,1,3],[3,8,9],[2,4,5],[4,5,7],[1,2,6],[2,5,6],[5,6,8],[1,3,8],[1,6,8],[5,8,9],[5,7,9]])
sortTri(11,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[1,2,5],[2,4,5],[4,5,7],[5,7,8],[5,6,8],[1,3,8],[1,6,8],[1,5,6]])
sortTri(12,[[0,1,2],[0,1,3],[7,8,9],[2,4,5],[1,2,6],[2,5,6],[5,6,8],[1,6,8],[4,7,8],[4,5,8],[1,8,9],[1,3,9]])
sortTri(13,[[0,1,2],[7,8,9],[3,8,9],[2,4,5],[1,2,6],[2,5,6],[5,6,8],[1,6,8],[4,7,8],[4,5,8],[0,1,8],[0,3,8]])
sortTri(14,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[1,2,5],[2,4,5],[5,6,8],[1,3,8],[1,6,8],[1,5,6],[4,7,8],[4,5,8]])
sortTri(15,[[0,1,2],[0,1,3],[2,4,5],[4,5,7],[1,2,6],[2,5,6],[5,6,8],[1,6,8],[5,8,9],[5,7,9],[1,8,9],[1,3,9]])
sortTri(16,[[0,1,3],[7,8,9],[3,8,9],[0,2,5],[0,1,5],[2,4,5],[5,6,8],[1,3,8],[1,6,8],[1,5,6],[4,7,8],[4,5,8]])
sortTri(17,[[0,1,2],[0,1,3],[7,8,9],[3,8,9],[5,6,8],[1,3,8],[1,6,8],[1,5,6],[4,7,8],[4,5,8],[1,4,5],[1,2,4]])
sortTri(18,[[0,1,2],[7,8,9],[3,8,9],[1,2,5],[2,4,5],[5,6,8],[1,6,8],[1,5,6],[4,7,8],[4,5,8],[0,1,8],[0,3,8]])
sortTri(19,[[7,8,9],[3,8,9],[0,2,5],[0,1,5],[2,4,5],[5,6,8],[1,6,8],[1,5,6],[4,7,8],[4,5,8],[0,1,8],[0,3,8]])
