| JPC 4.0 |
|---|
| Finished |
Hamza holds the Mansaf of his people very highly, so on his birthday, Ahmad decided he will give him a bunch of Mansaf dishes to rate.
If Hamza was to taste some set of dishes with yumminess $$$d_1, d_2, \ldots, d_k$$$, the value of this set is $$$\min\limits_{1 \leq i \leq k}d_i$$$.
Ahmad has $$$n$$$ options of dishes, each dish was from the restaurant $$$a_i$$$ and with a yumminess of $$$d_i$$$. Ahmad can only choose to buy all the dishes from only one restaurant, what is the biggest value he can provide Hamza?
The first line of the input contains an integer $$$t$$$ $$$(1 \leq t \leq 10^3)$$$ – the number of test cases.
For each test case, the first line contains an integer $$$n$$$ $$$(1 \leq n \leq 2\cdot 10^5)$$$.
The next $$$n$$$ lines each contains two integers $$$a_i$$$ $$$d_i$$$ $$$(1 \leq a_i, d_i \leq 10^9)$$$.
It's guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$5\cdot10^5$$$.
Print a single integer, the maximum value he can provide For Hamza, while only having the choice of the restaurant he buys from.
2410 24 510 74 641 1050 10123 7650 74
5 76
In the first test case, if he selects the restaurant number $$$10$$$ he will get a value of $$$2$$$, but if he selects the restaurant number $$$4$$$ he will get a value of $$$5$$$, so the answer is $$$5$$$.
| Name |
|---|


