Comments
+13

@saisumit : you cant cut the tree that way.

Read the problem statement carefully:

" they will choose prizes at the same time "

[ You can't cut one part, and choose the next part later ]

Also : " they decided to choose two different gifts so that the sets of the gifts that hang on them with a sequence of ropes and another gifts don't intersect "