The first line of the input contains a single integer $T$ ($1 \leq T \leq 10$), the number of test cases.
For each case, the first line of the input contains a string $A$ consists of $n$ ($1\leq n\leq 100\,000$) lower-case English letters.
The second line of the input contains a string $B$ consists of $m$ ($1\leq m\leq 20$) lower-case English letters.
The third line of the input contains a single integer $q$ ($1\leq q\leq 100\,000$), denoting the number of queries.
Then in the following $q$ lines, there are two integers $l_i,r_i$ ($1\leq l_i\leq r_i\leq n$) in each line, denoting a query.