not much familiar with python but i think m is making something like invisible sub-arrays ([0]*5) of 0’s in a array list for five for 5 times and n is making arrays of 5 zeros for five times . so when you do n[2][2]=1 it inserts in the 2nd element of 2nd arr in the arr of list and m[2][2]=1 it inserts in each element in sub arr in the arr of list .
[[0, 0, 0, 0, 0],- this is in position 0 in the arr
[0, 0, 0, 0, 0], - this is in position 1 in the arr
[0, 0, 1, 0, 0], - this is in position 2 in the arr and 1 is in pos 2 in the sub array
[0, 0, 0, 0, 0], - this is in position 3 in the arr
[0, 0, 0, 0, 0]] -this is in position 4 in the arr