An integer N (2 ≤ N ≤ 10,000), representing some quantity.
An integer M (1 ≤ M ≤ 1,000), representing another quantity.
A list of tuples (S, k, c1, ..., ck) for i from 1 to M, where:
- S is an integer (1 ≤ S ≤ 100),
- k is an integer (1 ≤ k ≤ N),
- c1, ..., ck are integers (1 ≤ c1 < ... < ck ≤ N).
The input ends with a pair of zeros.

### Example Input:

```
3 2
5 2 1 3
8 2 2 3
2 3
8 2 1 2
3 1 1
0 0
```

### Function Signature:
Write a function f(inputs) that takes in the input.
def f(inputs: List[Tuple[int, int, List[Tuple[int, int, List[int]]]]]):
    '''
    inputs: a list of tuples, each containing:
        - two integers
        - a list of tuples, each containing:
            - one integer
            - one integer
            - a list of integers
    '''