P18089 [UKIEPC 2026] Lawn Stripes
Description
You can create stripes on a lawn by using a roller to flatten the grass blades in a particular direction. From a distance, grass blades lying in different directions have different sheens. People often use this method to decorate lawns.
We want to use a roller to create stripes on the lawn in a square garden. The roller can roll in $4$ directions: up, down, left, and right, and it must never leave the lawn. The direction of the grass on each patch of lawn is determined by the direction in which the roller was moving the last time it passed over that patch. Starting from or stopping on a patch also counts as passing over it.

*Figure L.1: Illustration of Sample 1.*
Given the target pattern of the lawn and the starting position of the roller, find a way to produce the pattern.
Input Format
The first line contains an integer $n$ ($1 \le n \le 100$), representing the length and width of the lawn in meters.
The second line contains the row number $r$ and column number $c$ of the roller's starting position ($1 \le r,c \le n$).
The next $n$ lines each contain $n$ characters. Each character is one of `l`, `r`, `u`, and `d`, representing a target direction of left, right, up, and down, respectively, for the corresponding one-square-meter patch of lawn.
Output Format
If the pattern cannot be produced, output `impossible`. Otherwise, output a scheme with strictly fewer than $10n^2$ moves. The first line contains the number of moves, and each following line describes one move.
Each move consists of a distance $d$ in meters and a character `l`, `r`, `u`, or `d` representing the direction. While executing the instructions, the roller must pass over every square meter of the lawn and must not leave it.
Explanation/Hint
Translated by QwenWork