Vivek R. Korat 's submission of Greg and Grid | CodeChef