There are n teams on the playground, the i-th team has ai members. Each member has an Ability value, and each team's Ability value is increasing from head to tail. Now we want to find the n people with the highest Ability value among all of the members to form a new team. What is the Ability value of these n people? Xiaoming thinks this is a very simple problem, but now he is so busy. So he hope you can help him solve this problem
输入描述:
First line enter an integer n
In the next n lines, for each line, firstly enter a number ai which represent the number of people in the i-th team. Then enter ai numbers which represent the height of the i-th team from head to tail. Note that the Ability value of each team is increasing from head to tail
输出描述:
Output results in descending order on one line
示例1
输入
复制
3
3 1 2 4
3 2 3 3
3 3 3 4
备注:
1<=n<=2000
1<=ai<=4000000

=n*n
For all input data, it is guaranteed to be an integer and the result can be stored with int