How to solve SPOJ Paradox

Hi Team, I am stuck in SPOJ 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?

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:)