Dinesh Goyal's submission of PerMEXuation | CodeChef