# 乱択解法(最初のコピーのみ) import random import sys def main() -> None: n, t = map(int, sys.stdin.readline().split()) board = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] x, y = 0, 0 s_val = 0 ops: list[str] = [] ops.append("C") s_val = board[x][y] while len(ops) < t: directions = [] if x > 0: directions.append("U") if x + 1 < n: directions.append("D") if y > 0: directions.append("L") if y + 1 < n: directions.append("R") if directions: move = random.choice(directions) ops.append(move) if move == "U": x -= 1 elif move == "D": x += 1 elif move == "L": y -= 1 elif move == "R": y += 1 else: # No available moves; should not happen on a valid board break if len(ops) >= t: break new_val = board[x][y] ^ s_val if new_val > board[x][y]: ops.append("W") board[x][y] = new_val sys.stdout.write("\n".join(ops) + "\n") if __name__ == "__main__": main()