Cook-a-Code Online Qualifier question 2

hello
I am not able to understand question language so plz anyone help me so that i am getting an idea how to do that thankyou…

question link - https://www.codechef.com/CCOQ2019/problems/PERMPAIN

Thankyou…:slight_smile: