#C10414. Custom Zip Function Implementation

    ID: 39617 Type: Default 1000ms 256MiB

Custom Zip Function Implementation

Custom Zip Function Implementation

You are required to implement a custom version of the built-in zip function. The function custom_zip should take any number of iterables and return an iterator that aggregates elements from each iterable into tuples. The iteration stops when the shortest iterable is exhausted.

In this problem, the input will be provided from standard input (stdin). The first integer indicates the number of iterables. For each iterable, a line is given which starts with an integer representing the number of elements in that iterable, followed by the elements (as strings). Your task is to apply the custom zip function to these iterables and output the zipped tuples. Each tuple should be printed on a separate line with its elements separated by a single space.

Examples:

Input:
3
3 1 2 3
3 a b c
3 X Y Z

Output: 1 a X 2 b Y 3 c Z

</p>

inputFormat

The first line of input contains a single integer k which denotes the number of iterables. For each of the following k lines, the first number is an integer n which indicates the number of elements in that iterable, followed by n space-separated tokens. These tokens can be considered as strings.

outputFormat

Output the result of zipping the provided iterables. Each line of the output corresponds to one tuple containing the i-th element from each iterable. The elements in a tuple should be printed in the same order as the input iterables and separated by a single space.

## sample
3
3 1 2 3
3 a b c
3 X Y Z
1 a X

2 b Y 3 c Z

</p>