def sort(a): for k in range(len(a)): (a[k][0],a[k][1]) = (a[k][1],a[k][0]) a.sort() for k in range(len(a)): (a[k][0],a[k][1]) = (a[k][1],a[k][0])a = [[1,2,4],[6,5,6],[2,5,9]]sort(a)print(a)