A dispatch center manages k separate delivery queues, each already sorted in non-decreasing order of delivery priority and each modeled as a singly linked list. Merge all k queues into a single non-decreasing sequence containing every delivery from every queue. Print the merged sequence.
Input format
Line 1: an integer k — the number of queues.
Then, for each of the k queues, two lines:
- a line with an integer
n_i— the length of that queue. - a line with
n_ispace-separated integers, sorted in non-decreasing order — that queue's priorities.
Output format
A single line with all values from all queues, merged into non-decreasing order, space-separated.
Constraints
- 1 ≤ k ≤ 10
- 1 ≤ n_i ≤ 1000 for every queue i
- -1000000000 ≤ priority ≤ 1000000000
- each individual queue is given already sorted in non-decreasing order