An integer n (3 ≤ n ≤ 100), an integer m (2 ≤ m ≤ 1000), an integer s (1 ≤ s ≤ n), an integer g1 (1 ≤ g1 ≤ n), and an integer g2 (1 ≤ g2 ≤ n).
A list of tuples of integers (b1, b2, c) of size m, where each integer b1, b2 (1 ≤ b1, b2 ≤ n) and each integer c (1 ≤ c ≤ 1000).

### Example Input:

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

### Function Signature:
Write a function f(inputs) that takes in the input.
def f(inputs: List[Tuple[int, int, int, int, int, List[Tuple[int, int, int]]]]):
'''
inputs: a list of tuples, where each tuple contains five integers and a list of tuples
'''