I have a matrix n * m like this
m = [[1, 1, 2, 2], [3, 3, 4, 4]]
where elements in a row or column form a unit(1, 1), (2,2) etc. I need