An integer N (2 ≤ N ≤ 100), representing some quantity or size.
An integer M (1 ≤ M ≤ 1000), representing another quantity or size.
A list of M tuples (xi, yi, si) where each tuple consists of:
  - An integer xi (0 ≤ xi < N)
  - An integer yi (xi < yi ≤ N - 1)
  - An integer si (1 ≤ si ≤ 1000)

### Example Input:

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

### Function Signature:

Write a function f(N, M, paths) that takes in the input.
```
def f(N: int, M: int, paths: List[Tuple[int, int, int]]):
    '''
    N: an integer
    M: an integer
    paths: a list of tuples, where each tuple consists of three integers
    '''
```