apple pie's submission of Just a Graph | CodeChef