k=0
b = []
c = []
d = []
b = [[615 for i in range(9)] for j in range(9)]
'''为了防止修改列表时整列均改变'''
for i in range(9):
b[i][i] = 0
d.append(0)
b[0][1] = 10
b[0][5] = 11
b[1][2] = 18
b[1][6] = 16
b[1][8] = 12
b[2][3] = 22
b[2][8] = 8
b[3][4] = 20
b[3][7] = 16
b[3][8] = 21
b[4][5] = 26
b[4][7] = 7
b[5][6] = 17
b[6][7] = 19
for i in range(9):
for j in range(9):
if i>j:
b[i][j] = b[j][i]
c = b[0]
min = 615
i = 1
while i<9:
min = 615
j=1
while j<9:
if c[j]!=0 and c[j] < min:
min = c[j]
k = j
j+=1
print(d[k],'->',k)
j = 1
while j<9:
if c[j]!=0 and b[k][j]<c[j]:
c[j] = b[k][j]
d[j] = k
j+=1
i+=1