The robot is located on a checkered rectangular board of size n × m (n rows, m columns). The rows in the board are numbered from 1 to n from top to bottom, and the columns — from 1 to m from left to right.

The robot is able to move from the current cell to one of the four cells adjacent by side.

The sequence of commands s executed by the robot is given. Each command is denoted by one of the symbols 'L', 'R', 'D' or 'U', and triggers the movement to left, right, down or up, respectively.

The robot can start its movement in any cell. The robot executes the commands starting from the first one, strictly in the order in which they are listed in s. If the robot moves beyond the edge of the board, it falls and breaks. A command that causes the robot to break is not considered successfully executed.

The robot's task is to execute as many commands as possible without falling off the board. For example, on board 3 × 3, if the robot starts a sequence of actions s="RRDLUU" ("right", "right", "down", "left", "up", "up") from the central cell, the robot will perform one command, then the next command will force him to cross the edge. If the robot starts moving from the cell (2, 1) (second row, first column) then all commands will be executed successfully and the robot will stop at the cell (1, 2) (first row, second column).

<image> The robot starts from cell (2, 1) (second row, first column). It moves right, right, down, left, up, and up. In this case it ends in the cell (1, 2) (first row, second column).

Determine the cell from which the robot should start its movement in order to execute as many commands as possible.

Input

The first line contains an integer t (1 ≤ t ≤ 10^4) — the number of test cases.

The next 2t lines contain descriptions of the test cases.

In the description of each test case, the first line contains two integers n and m (1 ≤ n, m ≤ 10^6) — the height and width of the field that the robot is located on. The second line of the description is a string s consisting solely of characters 'L', 'R', 'D' and 'U' — the sequence of commands the robot executes. The string has a length from 1 to 10^6 commands.

It is guaranteed that the total length of s over all test cases does not exceed 10^6.

Output

Print t lines, each of which contains the answer to the corresponding test case. The answer to the test case are two integers r (1 ≤ r ≤ n) and c (1 ≤ c ≤ m), separated by a space — the coordinates of the cell (row number and column number) from which the robot should start moving to perform as many commands as possible.

If there are several such cells, you may output any of them.

Example

Input


4
1 1
L
1 2
L
3 3
RRDLUU
4 3
LUURRDDLLLUU


Output


1 1
1 2
2 1
3 2
import sys
#sys.setrecursionlimit(20000)
#from collections import deque #Counter
#from itertools import accumulate
#from functools import product
#import math


def rall():
    return sys.stdin.readlines()
def rl():
    return sys.stdin.readline().strip()
def rl_types(types):
    str_list = [x for x in sys.stdin.readline().strip().split(' ')]
    return [types[i](str_list[i]) for i in range(len(str_list))]

def pr( something='' ):
    sys.stdout.write( str(something) + '\n')
def pra( array ):
    sys.stdout.write( ' '.join([str(x) for x in array]) + '\n')


def solve(array):
    return array


if __name__ == '__main__':

    NT = int( rl() )
    #a,b = map(int,rl().split(' '))

    for ti in range(NT):
        n,m = map(int, rl().split(' '))
        commands = rl()

        start = [1,1]
        if n>1 or m>1:
            x,y = 0,0
            maxX,minX,maxY,minY = 0,0,0,0
            last_command = None
            for c in commands:

                #print('  ',x,y,c,end=' ')
                if c=='R':
                    x += 1
                    maxX = max(x,maxX)
                if c=='L':
                    x -= 1
                    minX = min(x,minX)
                if c=='U':
                    y -= 1
                    minY = min(y,minY)
                if c=='D':
                    y += 1
                    maxY = max(y,maxY)
                #print(x,y)
                #print(f'{c} minX={minX},maxX={maxX} minY={minY},maxY={maxY}')
                if maxX-minX==m:
                    #print('OFF!')
                    if c=='R':
                        maxX -= 1
                        x -= 1
                    if c=='L':
                        minX += 1
                        x += 1
                    break
                if maxY-minY==n:
                    print('OFF!')
                    if c=='U':
                        minY += 1
                        y += 1
                    if c=='D':
                        maxY -= 1
                        y -= 1
                    break

            #print(last_command)

            #print(f'minX={minX},maxX={maxX} minY={minY},maxY={maxY}')
            #print(x,y)
            #yrng = [1+nU,n-nD]
            ##xrng = [1+nL,m-nR]
            #start[0] = yrng[1] if nU>nD else yrng[0]
            #start[1] = xrng[1] if nL>nR else xrng[0]
            #print(xrng,yrng)
            start = [1-minY,1-minX]



        # vals = rl_types( [str,float,float] )
        pra(start)

