Byteasar runs the in-house choir at his company. Unfortunately, he is often short of singers, because every so often a group of choir members quits and moves abroad, so he constantly has to look for new people willing to sing.
The company where Byteasar works has a very tidy organizational structure: every employee except the boss has exactly one direct supervisor. When looking for new choir members, Byteasar asks a chosen employee to prepare a list of the best-singing people among that employee's subordinates. He also requires that the voice pitch of everyone on the list fall within a given range.
Here, the "subordinates" of an employee are all employees below them in the hierarchy (directly or indirectly), and do not include the employee themselves.
Write a program that:
The first line contains two integers n and q (1≤n≤100000, 1≤q≤20000): the number of employees and the number of questions.
Each of the next n lines contains three integers pi, wi, and si (0≤pi≤n, 0≤wi,si≤1000000000). Here pi is the supervisor of employee i (0 means this employee is the boss), wi is their voice pitch, and si is their singing ability (the higher the value, the better they sing). There is exactly one boss, and all employees have distinct singing abilities si.
Each of the next q lines contains four integers ti, ai, bi, and ki (1≤ti≤n, 0≤ai≤bi≤1000000000, 1≤ki≤1000000). This is a request for the ki best-singing employees among the subordinates of employee ti whose voice pitch lies in the range [ai,bi]. The sum of all ki does not exceed 100000.
Print q lines, one answer per question.
The answer to the i-th question lists the numbers of the matching subordinates, from the highest singing ability to the lowest, separated by single spaces on one line. If fewer than ki subordinates satisfy the condition, print all of their numbers and then append a single 0.