I\'m having problems figuring out a way to loop through a nested array and then to store the output in a desired order. Could you please help me to figure out a way to make