There are multiple test cases. The first line of the input contains an integerindicating the number of test cases. For each test case:
The first line contains two integersand
(
) -- the length of the string and the number of queries.
The second line contains a stringof length
consisting only of lowercase English letters.
Each of the nextlines contains three integers
,
and
(
) denoting a query.
It is guaranteed that neither the sum ofor the sum of
of all test cases will exceed
.
For each query output one line containing one integer denoting the answer.