An integer Q (1 ≤ Q ≤ 100), representing some quantity or number of queries.
A list of Q tuples (A_i, M_i), where each tuple contains two integers:
- \( A_i \) (0 ≤ \( A_i \) ≤ 10^9)
- \( M_i \) (1 ≤ \( M_i \) ≤ 10^9)

### Example Input:
```
4
2 4
3 8
9 6
10 7
```

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