So there's this question 939A - Love Triangle which has a tag of "graph" and I can't seem to find a solution for it. :( Although, the solution for this problem is available but it does not use graphs. I really wanted to know a solution which uses graph since it has a tag of "graph". Here's my approach for it 77461286
Here it checks for the number of vertices which has more than or equal to 3 occurences, if they are more than or equal to 3 then it prints YES. But, it fails on test 4. Please help.