The input consists of multiple datasets, each in the following format:

An integer N (1 ≤ N ≤ 100), representing some quantity or size.
An integer M (M ≥ 0), representing some quantity or size.
An integer L (1 ≤ L ≤ 10000), representing some quantity or size.

M lines follow, each containing:
- Two integers Ai and Bi (1 ≤ Ai < Bi ≤ N), representing some sequence or connection.
- An integer Di (1 ≤ Di ≤ 10000), representing some quantity or size.

A list of N integers P, each between 0 and 1e6, representing some quantity or size.
A list of N integers K, each between 0 and 1e6, representing some quantity or size.

### Example Input:

```
1 0 1
51
50
```

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