Soviet Kindergarden
시간 제한1초메모리 제한1024 MB
사과 값의 합이 전체 합의 절반을 넘도록 시작 칸에서 도착 칸까지 자기 교차 없는 경로를 찾아 출력한다.
문제
Mikhail Abramovich is a member of the CPSU since 1961, a doctor of sciences, a scientific atheist, loving dad and husband. He has a 10-year grandson Maxim. Maxim plays on his phone all day long instead of making science like his grandfather.
Maxim downloaded a new game "Snake 2022". The playing area of the "Snake 2022" is a rectangular table . Rows are enumerated from to , columns are enumerated from to . Cell is in the intersection of a row and a column .
There is an apple in each cell of the table. When the head of the snake gets to the cell, the snake immediately eats an apple from this cell. The player gets points when the snake eats an apple from the cell .
The snake has a length of at the beginning of the game. The snake's head starts at cell . The snake immediately eats an apple from a cell . The game ends when the snake's head gets to the cell .
The move in the game is moving the snake's head to any of the neighboring cells, in which there is no snake yet. On each move the snake eats an apple and increases its length by . The set of cells occupied by the snake remains the same, plus the cell in which the snake's head appears in the current move. The move of the snake is described by one symbol: "U" to move up, from to ; "D" to move down, from to ; "L" to move left, from to ; "R" to move right, from to .
Let be the total cost of apples on the whole table. The player wins if he gets strictly more than points. To simplify the game, it is guaranteed that any apple brings strictly fewer points than the total cost of apples in cells and .
"Snake 2022" is too difficult for Maxim, he can't win. He asked his grandfather for help. Mikhail Abramovich told Maxim the story of how in his youth the same problem was solved by an ordinary Soviet kindergartner.
You play the role of this kindergartner. Your task is to present a winning strategy for each configuration of the playing field from the tests.
입력
The first line of the input contains a single integer --- a number of the tests.
Each test is described in the following format. The first line contains six integers , , , , , --- the size of the table, coordinates of the start and finish cell (, , , the start and the finish cells are different). The sum for all tests in one set of input data does not exceed .
The next lines contain the costs of the apples in the table cells. The line contains integers (. It is guaranteed that for any and inequality is satisfied).
출력
Output a line containing symbols "U", "D", "L", "R" for each test case --- the sequence of the snake's moves, in which its head starts in the cell , ends in the cell , does not visit cells already occupied by the snake, and gets more than points.