import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here // 入力 Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); String str = sc.next(); String[] move = str.split(""); // 移動 int[][] grid = new int[N+1][N+1]; for(int i = 0; i <= N; i++){ for(int j = 0; j <= N; j++){ grid[i][j] = 1; } } int posX = 0; int posY = N; grid[N][0] = 0; for(int i = 0; i < M; i++){ if(move[i].equals("R")){ posX++; } else if(move[i].equals("L")){ posX--; } else if(move[i].equals("D")){ posY++; } else if(move[i].equals("U")){ posY--; } grid[posY][posX] = 0; } // 出力 for(int i = 0; i <= N; i++){ for(int j = 0; j <= N; j++){ System.out.print(grid[i][j] + " "); } System.out.println(""); } } }