Andrey Kim's submission of Save The Princess | CodeChef