Charlie is the head of HR at a large company. Every employee except the CEO reports to one or more people. Nobody reports to themselves, directly or indirectly.
This year's budget arrived and the salary line was cut by C dollars. Charlie does not like firing people, so he wrote a program that automatically fires any employee left with nobody to report to. The program repeats until no employee other than the CEO is without a manager. It never fires the CEO automatically, even though the CEO reports to nobody.
Charlie will fire exactly one person by hand and let the program handle the rest. The total salary of everyone fired has to be at least C dollars, and among the choices that reach C it has to be as close to C as possible. If several employees produce the same total, pick the one with the largest employee number. A CEO can be incompetent too, so Charlie may fire the CEO.
The first line contains one integer T, the number of test cases.
Each test case begins with a line containing two integers N and C, the number of employees and the amount to save.
The next N lines describe employees 0 through N−1 in order. The line for employee i starts with the salary Si and the number of people Ri that employee i reports to, followed by Ri numbers Eij, the employee numbers of those people.
For each test case, print on its own line the employee number of the person Charlie should fire.