DRAW FIXING

I tried to solve the problem Draw Fixing from the IARCS Problem archieve ( Indian National Olympiad in Informatics - Online Programming Contest - IARCS ) but is showing WA. The problem can have multiple solutions. Please help me find my error.

My code: