An integer N (2 ≤ N ≤ 10^5), representing some quantity or size.
A list of N tuples, where each tuple contains four integers: (x1, y1, x2, y2). Each integer is between 0 and 100. For every tuple, (x1, y1) is not equal to (x2, y2).

### Example Input:

```
4
2 0 2 25
0 30 15 20
16 20 5 15
23 0 23 30
```

### Function Signature:
Write a function f(N, segments) that takes in the input.
```python
def f(N: int, segments: List[Tuple[int, int, int, int]]):
    '''
    N: an integer
    segments: a list of tuples, where each tuple contains four integers
    '''
```