#C4795. Custom Zip Function

    ID: 48372 Type: Default 1000ms 256MiB

Custom Zip Function

Custom Zip Function

You are given several iterables. Your task is to implement a program that simulates the behavior of Python's built-in zip function. The program should take multiple sequences, and output tuples of elements at corresponding positions from each sequence. The iteration stops when the shortest sequence is exhausted.

Example:

Input:
3
3 1 2 3
3 a b c
3 True False None

Output: 1 a True 2 b False 3 c None

</p>

For each test case, output each zipped tuple in a new line. If there are multiple test cases, separate the outputs by an empty line.

Note: The input will be read from standard input and the output should be written to standard output.

inputFormat

The input begins with an integer T representing the number of test cases. For each test case:

  • The first line contains an integer N — the number of iterables.
  • The next N lines each start with an integer L representing the length of that iterable, followed by L space-separated tokens.

You should process each test case independently.

outputFormat

For each test case, output the zipped result: each line corresponds to a tuple consisting of one element from each iterable (taken in order), with elements separated by a single space. If no tuple can be formed, output nothing for that test case. Separate outputs of different test cases by an empty line.

## sample
3
3
3 1 2 3
3 a b c
3 True False None
3
2 1 2
3 a b c
1 True
2
3 a b c
3 1 2 3
1 a True

2 b False 3 c None

1 a True

a 1 b 2 c 3

</p>