Convert a tree with depth N to N linked lists