Problem : A New Order
PROBLEM LINK
MY CODE
I tried to solve this question using topological sort but I got only partial points. Please Help.