How to solve SPOJ Paradox

Hi Team, I am stuck in SPOJ PARADOX http://www.spoj.com/problems/PARADOX/

I m not able figure out any algorithmic approach for this problem.Can anyone please tell me how to apply graph algo on this problem?

https://www.quora.com/What-is-the-algorithmic-approach-to-solving-the-problem-Paradox-on-SPOJ

This might be helpful

I think problem link is broken.

The link has been fixed. Thanks for notifying ^^

thanks for your reply @hruday968.but, I have already read this question explanation on Quora and code forces and from some other links, but I am not getting anything from them. So If you could explain the idea/approach in a simple manner, that will be a great help.btw thanks for your effort:)