I was trying to solve Codeforces 141C Queue. even after looking at editorial and submissions of other coders i couldn't reach in a state of solving this problem. I didn't understand what is the idea behind implementation and and how we reach to the conclusion whether solution exist or not. Thanks in Advance.