Pawns#898

Pawns

5 seconds
64 megabytes
Medium

In the first grade, Gleb developed a keen interest in chess. At that time, he only knew how the pawn moves: it can capture diagonally to the left-up and right-up, and move one square up if that square is unoccupied. Gleb was unaware that a pawn can be promoted to a queen, so he invented his own version of chess.

This game is played on a board with rows and columns (1 \leq N \leq 100, 1 \leq M \leq 100) with the following rules. On the bottom row, numbered , there are white pawns, and no other white pieces are present on the board. Various black pieces (whose names Gleb does not know) are placed elsewhere on the board. Only the white pawns are allowed to move, and their goal is to capture all the black pieces.

As in standard chess, when a pawn captures a black piece, it moves to that square, and the captured piece is removed from the board. Gleb wins if he manages to capture all the black pieces with his pawns; otherwise, he loses. Given the initial configuration of all the pieces, determine whether he can win, and if so, print a valid sequence of moves for the white pawns.

Input

The first line contains four integers , , , (1 \leq N \leq 100, 1 \leq M \leq 100, 0 \leq P \leq M, 1 \leq K \leq 1000, K \leq (M-1)\cdot N). Then distinct integers follow: the column numbers p_j (1 \leq p_j \leq M) where the white pawns are located. After that, distinct pairs of integers are given: the coordinates (row and column) of the black pieces r_i, c_i (2 \leq r_i \leq N, 1 \leq c_i \leq M).

Output

If the pawns cannot capture all the pieces, output the single word NO.

Otherwise, output YES on the first line. The second line should contain the total number of moves , followed by lines describing each move, one per line. Each move is specified by the coordinates , of the pawn (row and column numbers) that will move, and a symbol , which can be: L for capturing forward and left, R for capturing forward and right, or F for moving forward. Each move should be output with a single space separating the coordinates and the type of move.

If there are multiple valid sequences of moves, output any one of them. Note that minimizing the number of moves is not required.

Examples

Example 1

Loading
Loading