TI10 and ICPC World Finals 2020, which will be held earlier? Take a bet!
The International(TI) is the biggest and most prestigious event of Dota2 and is commonly held annually in August. The Dota2 teams should try to earn points to be eligible to compete in TI. There are two ways of earning points, first is by competing in the regional contests, second is by competing in the tournaments, where all teams are gathered to compete together and earn points according to their rank in the tournament. A team's final score is the sum of scores from both the regional contests and tournaments.
Now that the regional contests have finished, there are $n$ teams taking part, and the $i$th team has earned $a_i$ points from the regional contests. Also, the team that gets the $i$th rank in the tournament can gain $b_i$ points.
cyz is a huge fan of Dota2. So before the tournament starts, he will predict the final rank of all teams. cyz wants to know, for each team, what's its best possible rank and its worst possible rank after the tournament finishes.
If a team has a final score equal to $x$, its rank is defined as one plus the number of teams with a strict higher score than it. For example, if the final score of four teams are $700,500,500,300$ respectively, then their final ranks are $1,2,2,4$, respectively.