How does your code generate the output you want?