LearnPy Hub
← Arena
IntermediateRating 1300

Merge Many Sorted Lists

k lists are each sorted. Print all their numbers merged in sorted order.

Input

k, then k lines (each starts with its length).

Output

One line.

Sample 1

Input
3
3 1 4 5
3 1 3 4
2 2 6
Output
1 1 2 3 4 4 5 6

Sample 2

Input
1
1 0
Output
0
solution.py
Output appears here
Merge Many Sorted Lists · Python Arena problem · LearnPy Hub