queue
题号:NC207454
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

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

输出

复制
4 4 3

备注:

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