See Problem N for PDF statements.
The first line of the input contains an integer(
), indicating the number of test cases.
For each test case, the first line contains two integers(
), indicating the number of nodes and the number of queries.
The second line contains a string of lengthconsisting of
or
, indicating the characters written on nodes from
to
.
Each of the followinglines contains two integers
(
), indicating an edge connecting nodes
and
. It is guaranteed that these edges form a tree.
Each of the followinglines contains two integers
(
), indicating a query with nodes
and
.
It is guaranteed thatand
over all test cases.
For each query, output the answer in a single line.