How Nested For Loop Works