Anmol Khurana's submission of Greg and Grid | CodeChef