You are given a hierarchical tree of items, their categories, and the subcategories of a company. Key numbers from 1 to N are assigned to the items in no specific order.
Write a program that introduces a discount D on any category, sub-category or product that helps in applying discounts and to display the discount on a particular product when queried.
Return an array of integers consisting of answers to each of the query corresponding to B[i]=1.
2 ≤ N ≤ 100000
1 ≤ Q ≤ 100000
1 ≤ A[i], A[i] ≤ N
0 ≤ B[i] ≤ 60 when B[i]=0
B[i] with B[i]=1 will only be the key of products
B[i] with B[i]=0 can be any key from [1, N]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.