Sone has a mischievous pet named Jie.
One day, Sone was studying string matching problems.
Before leaving, Sone placed two strings on the table: a string $a$ of length $n$ and a string $b$ of length $m$. Let $\Sigma$ be the size of the character set, meaning every character in the strings is an integer between $1$ and $\Sigma$.
Before leaving, Sone sternly warned Jie: "Do not touch string $b$, that string is very important!"
Consequently, Jie could only mess with string $a$.
Let $a[l:r]$ denote the substring of $a$ from the $l$-th character to the $r$-th character. Specifically, when $l > r$, $a[l:r]$ denotes an empty string.
Jie defined a function for strings $s$ and $t$:
$$f(s,t)=\max_{s[1:k]=t[1:k]}k$$
This is the length of the longest common prefix of $s$ and $t$.
Jie also defined a function $F(a,b)$ for strings $a$ and $b$. The value of $F(a,b)$ is a tuple $(x,y)$, where $x$ is:
$$x=\max_{i=1}^{\lvert a \rvert} f(a[i:\lvert a \rvert],b)$$
And $y$ represents the number of indices $i$ such that $f(a[i:\lvert a \rvert], b) = x$.
The problem was originally very simple, but because Jie is so mischievous, there are $q$ moments in time, and at each moment he performs one of four actions:
- He modifies a character in string $a$ and then queries $F(a,b)$. (The modification to $a$ persists.)
- He chooses a substring $c$ of $a$ and queries $F(c,b)$.
- He chooses two suffixes of string $b$ and queries the length of their longest common prefix.
- He chooses two substrings $s_1$ and $s_2$ of $b$ and queries whether the string formed by concatenating $s_1$ and $s_2$ is a substring of $b$. If it is, output "yes", otherwise output "no" (without quotes).
Jie is now confused and hopes that you, being clever, can solve this problem.
Input
Let $\Sigma$ be the size of the character set, meaning every character in the strings is an integer between $1$ and $\Sigma$.
The first line contains an integer representing the test case ID. (The test case ID for samples and extra tests is an integer between $0$ and $20$.)
The second line contains a positive integer representing the length $n$ of string $a$.
The third line contains $n$ integers between $1$ and $\Sigma$ representing string $a$.
The fourth line contains a positive integer representing the length $m$ of string $b$.
The fifth line contains $m$ integers between $1$ and $\Sigma$ representing string $b$.
The sixth line contains a positive integer representing the number of queries $q$.
The next $q$ lines describe the operations, each containing several integers. The first integer $x$ represents the operation type:
- If $x=1$, it is followed by two integers $y, z$, representing changing the $y$-th character of string $a$ to $z$. $1 \leq y \leq n$, $1 \leq z \leq \Sigma$.
- If $x=2$, it is followed by two integers $y, z$, representing a query on the substring of $a$ in the range $[y, z]$. $1 \leq y \leq z \leq n$.
- If $x=3$, it is followed by two integers $y, z$, representing a query on the two suffixes starting at positions $y$ and $z$ in string $b$. $1 \leq y, z \leq m$.
- If $x=4$, it is followed by four integers $l_1, r_1, l_2, r_2$, representing a query on the two substrings of $b$ in ranges $[l_1, r_1]$ and $[l_2, r_2]$. $1 \leq l_1 \leq r_1 \leq m$, $1 \leq l_2 \leq r_2 \leq m$.
Output
There are $q$ lines, each containing the answer to the corresponding operation.
Examples
Input 1
0 10 1 2 3 3 3 1 2 3 2 1 3 1 3 1 10 3 1 3 4 3 3 2 2 2 2 10 1 3 2 2 7 9 2 7 10 2 3 9 2 2 8 1 7 1 1 4 2
Output 1
1 yes 1 2 1 3 0 3 1 1 1 1 1 1 2 1 2 1
Constraints
| Test Case ID | $n$ | $m$ | $q$ | $\Sigma$ | Note |
|---|---|---|---|---|---|
| 1,2 | $= 1000$ | $\leq 100$ | $= 1000$ | $\leq 100000$ | None |
| 3,4 | $= 100000$ | $\leq 100$ | $= 100000$ | No operation 2 | |
| 5,6 | $= 100000$ | $\leq 30$ | $= 100000$ | None | |
| 7,8 | $= 100000$ | $\leq 100000$ | $= 100000$ | Only operation 3 | |
| 9,10 | Only operation 4 | ||||
| 11,12 | $\leq 5$ | String $b$ is generated by: manually determining the proportion of each character, then uniformly randomly selecting a string satisfying this proportion as $b$ | |||
| 13,14 | |||||
| 15,16 | |||||
| 17,18 | $\leq 100000$ | None | |||
| 19,20 |