The main concept is to form a cycle of minimum length.
==> here 1 and 2 we have select. But for 3 we have an option. we can put this weight in the cycle of length three.
==>So, we can't select the weight 3 because it will form the cycle.
using this concept we can further proceed the question