First line contains a single integer $T(1 \le T \le 20)$ representing the number of test cases.
For each case:
The first line contains four integers $n, m, k, l$ $(1 \le n, m \le 50, 0 \le k, l \le n \times m)$, represents the size of the Frost Temple, the number of gem stones and the number of turning stones.
The following $n$ lines, each line contains $m$ characters, represents the map of the Frost Temple. For each character:
$\qquad \cdot$ '.' represents the empty grid.
$\qquad \cdot$ 'U'', 'D', 'L', 'R' represents there's a ray source, and the direction of it (up, down, left or right).
$\qquad \cdot$ '$\wedge$' (the character above '6' on the keyboard), 'v', '<', '>' represents there's a turning stone, and the initial direction of it (up, down, left or right), its cost is given in the following $l$ lines.
$\qquad \cdot$ 'x' represents there's a gem stone, its value is given in the following $k$ lines.
$\qquad \cdot$ '#' represents there's a wall.
The following $k$ lines, each line contains three integers $x_{i}, y_{i}, v_{i}$ $(1 \le x_{i} \le n, 1 \le y_{i} \le m, 0 \le v_{i} \le 10^{9})$, representing that the value of $(x_{i}, y_{i})$ is $v_{i}$.
The following $l$ lines, each line contains three integers $x_{i}, y_{i}, z_{i}$ $(1 \le x_{i} \le n, 1 \le x_{i} \le m, 0 \le c_{i} \le 10^{9})$, representing that the cost of $(x_{i}, y_{i})$ is $c_{i}$.
It is guaranteed that all the positions appear in the last $k+l$ lines are distinct.