Schedule
Anton is a courier in the city of N-sk, juggling numerous delivery orders. Each order takes exactly 1 day to complete. Every order comes with a specific reward and a deadline, which is the number of days left until the order must be finished. One morning, Anton realized he might not be able to fulfill all the orders, risking his job. To avoid this, he decided to focus on completing a selection of orders that would maximize his earnings.
Input
The first line of the input contains the number of test cases. For each test case, the first line contains an integer N (1 ≤ N ≤ 1000), representing the number of orders in that test case. The following N lines provide details for each order, with T_i and C_i (both natural numbers not exceeding 10^5). Here, T_i is the deadline by which the order must be completed, and C_i is the reward for completing the order.
Output
For each test case, output a single number on a separate line, representing the maximum reward Anton can earn by completing the orders.