Look at your data (and it's kinda odd).
What is element 2 of
ls
?
Answer:
ls[0] is 1,
ls[1] is 2,
ls[2] is 3,
...
And ls[5] is:
['1stlayer',1,2,3,4,5,['2ndlayer',1,2,3,4,5,['3rdlayer',1,2,3,4,5,['4thlayer',1,2,3,4,5,['5thlayer',1,2,3,4,5,['6thlayer',1,2,3,4,5,['7thlayer',1,2,3,4,5]]]]]]]
I suspect that you need to rethink exactly what your data should look like; I have no idea what you are trying to do, but that all looks very, very wrong!