“Wonderland”, the society, recently took an outstanding initiative to run a social experiment on people. The aim of this experiment is to make the privileged people understand how to use free resource with the least point and leave the resources with more points for others who need the most. This is known as the Rule of Equity.
The authority wants to perform the experiment on people, where each of them will have points according to how privileged they are. One who has more points is considered to be more privileged. Then they will be given resources to choose from. Each of them has to choose exactly one resource for them obeying the “rule of equity”. In this experiment, person with higher points will choose the resource earlier. Their final privilege point will be the sum of earlier privilege point and the point of chosen free resource.
You are one of the judges of this experiment, so you want to find the final privilege point of each candidate.
First line will contain , represents the number of people participating in the experiment.
Second line contains - the elements of the array , which represents the privilege points of each participant.
Third line contains - the elements of the array , which represents the points of free resources.
Output an array of length , which represents the total points of each candidate. Output the point of person in the order of they select the resources.
N.B. Don't print any extra space at the end of any line.
4 12 2 11 30 20 13 6 20
36 25 31 22
5 8 10 7 4 10 9 15 12 10 14
19 20 20 21 19