An integer N (1 ≤ N ≤ 500000), representing some quantity or size.
A string S of length N, consisting of lowercase English letters.
An integer Q (1 ≤ Q ≤ 20000), representing the number of queries.
Q queries, where each query is either of the form:
- "1 i_q c_q": An integer i_q (1 ≤ i_q ≤ N) and a character c_q (a lowercase English letter).
- "2 l_q r_q": Two integers l_q and r_q (1 ≤ l_q ≤ r_q ≤ N).

### Example Input:

```
7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7
```

### Function Signature:
Write a function f(N, S, Q, queries) that takes in the input.
```python
def f(N: int, S: str, Q: int, queries: List[Tuple[int, ...]]):
    '''
    N: an integer
    S: a string
    Q: an integer
    queries: a list of tuples, where each tuple is either (1, i_q, c_q) or (2, l_q, r_q)
    '''
```