let [| n; _ |] = stdin.ReadLine().Split() |> Array.map int let s = stdin.ReadLine() let table = [| for _ in 0..n -> Array.create (n + 1) 1 |] table.[n].[0] <- 0 let mutable x = 0 let mutable y = n for c in s do match c with | 'U' -> y <- y - 1 | 'D' -> y <- y + 1 | 'L' -> x <- x - 1 | 'R' -> x <- x + 1 | _ -> () table.[y].[x] <- 0 table |> Array.iter ( Array.map string >> String.concat " " >> printfn "%s" )