Help me in solving BROKPHON problem

My issue

My code

# cook your dish here
for x in range()

Problem Link: BROKPHON Problem - CodeChef