l1 = input().strip().split(' ') l2 = input().strip().split(' ') l3 = input().strip().split(' ') magic={} magic["a"]= int(l1[0]) magic["b"]= int(l1[1]) magic["c"]= int(l1[2]) magic["d"]= int(l2[0]) magic["e"]= int(l2[1]) magic["f"]= int(l2[2]) magic["g"]= int(l3[0]) magic["h"]= int(l3[1]) magic["i"]= int(l3[2]) m1=[8,1,6,3,5,7,4,9,2] m2=[8,3,4,1,5,9,6,7,2] m3=[6,7,2,1,5,9,8,3,4] m4=[4,9,2,3,5,7,8,1,6] m5=[2,9,4,7,5,3,6,1,8] m6=[2,7,6,9,5,1,4,3,8] m7=[4,3,8,9,5,1,2,7,6] m8=[6,1,8,7,5,3,2,9,4] def ScoreFunc(myList = []): score = abs(magic["a"]-myList[0]) score += abs(magic["b"]-myList[1]) score += abs(magic["c"]-myList[2]) score += abs(magic["d"]-myList[3]) score += abs(magic["e"]-myList[4]) score += abs(magic["f"]-myList[5]) score += abs(magic["g"]-myList[6]) score += abs(magic["h"]-myList[7]) score += abs(magic["i"]-myList[8]) return score lowestscore = ScoreFunc(m1) if (ScoreFunc(m2)