Devesh Agarwal's submission of Next Permutation | CodeChef