An integer N (1 ≤ N ≤ 10^5), representing some quantity or size.
A list of N tuples, each containing a string and an integer. The string is a sequence of lowercase alphabets of length between 1 and 20, and the integer is between 1 and 10^5.
An integer M (1 ≤ M ≤ 10^5).
A list of M strings, each string is a sequence of lowercase alphabets of length between 1 and 20.

### Example Input:

```
2
white 20
black 10
2
black
white
```

### Function Signature:
Write a function f(N, A, M, B) that takes in the input.
```python
def f(N: int, A: List[Tuple[str, int]], M: int, B: List[str]):
    '''
    N: an integer
    A: a list of tuples, where each tuple contains a string and an integer
    M: an integer
    B: a list of strings
    '''
```